Changeset 64227 in webkit
- Timestamp:
- Jul 28, 2010 1:21:04 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64225 r64227 1 2010-07-28 Stephen White <senorblanco@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 Hook the GLES2 rendering path up to GraphicsContextSkia. 6 https://bugs.webkit.org/show_bug.cgi?id=43119 7 8 This connects the state-setting and drawing calls implemented in 9 so far in GLES2Canvas, and calls PlatformContextSkia's 10 prepareForSoftwareDraw() for all the non-accelerated paths. 11 12 * platform/graphics/skia/GraphicsContextSkia.cpp: 13 (WebCore::GraphicsContext::addInnerRoundedRectClip): 14 (WebCore::GraphicsContext::addPath): 15 (WebCore::GraphicsContext::beginPath): 16 (WebCore::GraphicsContext::clip): 17 (WebCore::GraphicsContext::drawConvexPolygon): 18 (WebCore::GraphicsContext::drawEllipse): 19 (WebCore::GraphicsContext::drawFocusRing): 20 (WebCore::GraphicsContext::drawLine): 21 (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar): 22 (WebCore::GraphicsContext::drawLineForText): 23 (WebCore::GraphicsContext::drawRect): 24 (WebCore::GraphicsContext::fillPath): 25 (WebCore::GraphicsContext::fillRoundedRect): 26 (WebCore::GraphicsContext::strokeArc): 27 (WebCore::GraphicsContext::strokePath): 28 (WebCore::GraphicsContext::strokeRect): 29 These calls are software-only; call preSoftwareDraw() for these. 30 (WebCore::GraphicsContext::savePlatformState): 31 (WebCore::GraphicsContext::restorePlatformState): 32 (WebCore::GraphicsContext::setAlpha): 33 (WebCore::GraphicsContext::setCompositeOperation): 34 (WebCore::GraphicsContext::setPlatformFillColor): 35 (WebCore::GraphicsContext::scale): 36 (WebCore::GraphicsContext::rotate): 37 (WebCore::GraphicsContext::translate): 38 (WebCore::GraphicsContext::concatCTM): 39 These ones set state on both Skia and GLES2Canvas. 40 (WebCore::GraphicsContext::clearRect): 41 (WebCore::GraphicsContext::fillRect): 42 These ones have a GLES2 implementation; call through to it if PlatformContextSkia's useGPU() flag is set and the state permits. 43 * platform/graphics/skia/PlatformContextSkia.cpp: 44 (PlatformContextSkia::prepareForSoftwareDraw): 45 (PlatformContextSkia::prepareForHardwareDraw): 46 Rename preXXXDraw() -> prepareForXXXDraw(). 47 * platform/graphics/skia/PlatformContextSkia.h: 48 (PlatformContextSkia::prepareForSoftwareDraw): 49 (PlatformContextSkia::prepareForHardwareDraw): 50 Rename preXXXDraw() -> prepareForXXXDraw(). 51 1 52 2010-07-28 fsamuel@chromium.org <fsamuel@chromium.org> 2 53 -
trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r63864 r64227 54 54 #include <wtf/Assertions.h> 55 55 #include <wtf/MathExtras.h> 56 57 #if USE(GLES2_RENDERING) 58 #include "GLES2Canvas.h" 59 #endif 56 60 57 61 using namespace std; … … 244 248 return; 245 249 250 #if USE(GLES2_RENDERING) 251 if (platformContext()->useGPU()) 252 platformContext()->gpuCanvas()->save(); 253 #endif 254 246 255 // Save our private State. 247 256 platformContext()->save(); … … 252 261 if (paintingDisabled()) 253 262 return; 263 264 #if USE(GLES2_RENDERING) 265 if (platformContext()->useGPU()) 266 platformContext()->gpuCanvas()->restore(); 267 #endif 254 268 255 269 // Restore our private State. … … 291 305 return; 292 306 307 platformContext()->prepareForSoftwareDraw(); 293 308 SkPath path; 294 309 path.addOval(r, SkPath::kCW_Direction); … … 308 323 if (paintingDisabled()) 309 324 return; 325 platformContext()->prepareForSoftwareDraw(); 310 326 platformContext()->addPath(*path.platformPath()); 311 327 } … … 315 331 if (paintingDisabled()) 316 332 return; 333 platformContext()->prepareForSoftwareDraw(); 317 334 platformContext()->beginPath(); 318 335 } … … 329 346 if (paintingDisabled()) 330 347 return; 348 349 #if USE(GLES2_RENDERING) 350 if (platformContext()->useGPU()) { 351 platformContext()->prepareForHardwareDraw(); 352 platformContext()->gpuCanvas()->clearRect(rect); 353 return; 354 } 355 #endif 356 357 platformContext()->prepareForSoftwareDraw(); 331 358 332 359 SkRect r = rect; … … 349 376 return; 350 377 378 platformContext()->prepareForSoftwareDraw(); 351 379 platformContext()->canvas()->clipRect(r); 352 380 } … … 361 389 return; 362 390 391 platformContext()->prepareForSoftwareDraw(); 363 392 platformContext()->clipPathAntiAliased(p); 364 393 } … … 442 471 if (paintingDisabled()) 443 472 return; 473 474 #if USE(GLES2_RENDERING) 475 if (platformContext()->useGPU()) 476 platformContext()->gpuCanvas()->concatCTM(affine); 477 #endif 478 444 479 platformContext()->canvas()->concat(affine); 445 480 } … … 454 489 if (numPoints <= 1) 455 490 return; 491 492 platformContext()->prepareForSoftwareDraw(); 456 493 457 494 SkPath path; … … 500 537 return; 501 538 539 platformContext()->prepareForSoftwareDraw(); 502 540 SkPaint paint; 503 541 platformContext()->setupPaintForFilling(&paint); … … 525 563 return; 526 564 565 platformContext()->prepareForSoftwareDraw(); 527 566 SkRegion focusRingRegion; 528 567 const SkScalar focusRingOutset = WebCoreFloatToSkScalar(0.5); … … 558 597 if (!isPointSkiaSafe(getCTM(), point1) || !isPointSkiaSafe(getCTM(), point2)) 559 598 return; 599 600 platformContext()->prepareForSoftwareDraw(); 560 601 561 602 FloatPoint p1 = point1; … … 604 645 if (paintingDisabled()) 605 646 return; 647 648 platformContext()->prepareForSoftwareDraw(); 606 649 607 650 // Create the pattern we'll use to draw the underline. … … 685 728 return; 686 729 730 platformContext()->prepareForSoftwareDraw(); 731 687 732 int thickness = SkMax32(static_cast<int>(strokeThickness()), 1); 688 733 SkRect r; … … 705 750 return; 706 751 752 platformContext()->prepareForSoftwareDraw(); 753 707 754 SkRect r = rect; 708 755 if (!isRectSkiaSafe(getCTM(), r)) { … … 723 770 return; 724 771 772 platformContext()->prepareForSoftwareDraw(); 773 725 774 const GraphicsContextState& state = m_common->state; 726 775 path.setFillType(state.fillRule == RULE_EVENODD ? … … 746 795 } 747 796 797 #if USE(GLES2_RENDERING) 798 if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient) { 799 platformContext()->prepareForHardwareDraw(); 800 platformContext()->gpuCanvas()->fillRect(rect); 801 return; 802 } 803 #endif 804 805 platformContext()->prepareForSoftwareDraw(); 806 748 807 SkPaint paint; 749 808 platformContext()->setupPaintForFilling(&paint); … … 757 816 if (paintingDisabled()) 758 817 return; 818 819 #if USE(GLES2_RENDERING) 820 if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient) { 821 platformContext()->prepareForHardwareDraw(); 822 platformContext()->gpuCanvas()->fillRect(rect, color, colorSpace); 823 return; 824 } 825 #endif 826 827 platformContext()->prepareForSoftwareDraw(); 759 828 760 829 SkRect r = rect; … … 790 859 return; 791 860 861 platformContext()->prepareForSoftwareDraw(); 862 792 863 SkRect r = rect; 793 864 if (!isRectSkiaSafe(getCTM(), r)) … … 873 944 if (paintingDisabled()) 874 945 return; 946 947 #if USE(GLES2_RENDERING) 948 if (platformContext()->useGPU()) 949 platformContext()->gpuCanvas()->scale(size); 950 #endif 951 875 952 platformContext()->canvas()->scale(WebCoreFloatToSkScalar(size.width()), 876 953 WebCoreFloatToSkScalar(size.height())); … … 881 958 if (paintingDisabled()) 882 959 return; 960 #if USE(GLES2_RENDERING) 961 if (platformContext()->useGPU()) 962 platformContext()->gpuCanvas()->setAlpha(alpha); 963 #endif 883 964 platformContext()->setAlpha(alpha); 884 965 } … … 888 969 if (paintingDisabled()) 889 970 return; 971 #if USE(GLES2_RENDERING) 972 if (platformContext()->useGPU()) 973 platformContext()->gpuCanvas()->setCompositeOperation(op); 974 #endif 890 975 platformContext()->setXfermodeMode(WebCoreCompositeToSkiaComposite(op)); 891 976 } … … 974 1059 if (paintingDisabled()) 975 1060 return; 1061 #if USE(GLES2_RENDERING) 1062 if (platformContext()->useGPU()) 1063 platformContext()->gpuCanvas()->setFillColor(color, colorSpace); 1064 #endif 1065 976 1066 platformContext()->setFillColor(color.rgb()); 977 1067 } … … 1103 1193 return; 1104 1194 1195 platformContext()->prepareForSoftwareDraw(); 1196 1105 1197 SkPaint paint; 1106 1198 SkRect oval = r; … … 1134 1226 return; 1135 1227 1228 platformContext()->prepareForSoftwareDraw(); 1229 1136 1230 SkPaint paint; 1137 1231 platformContext()->setupPaintForStroking(&paint, 0, 0); … … 1146 1240 if (!isRectSkiaSafe(getCTM(), rect)) 1147 1241 return; 1242 1243 platformContext()->prepareForSoftwareDraw(); 1148 1244 1149 1245 SkPaint paint; … … 1158 1254 return; 1159 1255 1256 #if USE(GLES2_RENDERING) 1257 if (platformContext()->useGPU()) 1258 platformContext()->gpuCanvas()->rotate(angleInRadians); 1259 #endif 1260 1160 1261 platformContext()->canvas()->rotate(WebCoreFloatToSkScalar( 1161 1262 angleInRadians * (180.0f / 3.14159265f))); … … 1167 1268 return; 1168 1269 1270 #if USE(GLES2_RENDERING) 1271 if (platformContext()->useGPU()) 1272 platformContext()->gpuCanvas()->translate(w, h); 1273 #endif 1274 1169 1275 platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w), 1170 1276 WebCoreFloatToSkScalar(h)); -
trunk/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r64161 r64227 683 683 } 684 684 685 void PlatformContextSkia::pre SoftwareDraw() const685 void PlatformContextSkia::prepareForSoftwareDraw() const 686 686 { 687 687 if (!m_useGPU) … … 725 725 } 726 726 727 void PlatformContextSkia::pre HardwareDraw() const727 void PlatformContextSkia::prepareForHardwareDraw() const 728 728 { 729 729 if (!m_useGPU) -
trunk/WebCore/platform/graphics/skia/PlatformContextSkia.h
r64161 r64227 192 192 // Call these before making a call that manipulates the underlying 193 193 // skia::PlatformCanvas or WebCore::GLES2Canvas 194 void pre SoftwareDraw() const;195 void pre HardwareDraw() const;194 void prepareForSoftwareDraw() const; 195 void prepareForHardwareDraw() const; 196 196 // Call to force the skia::PlatformCanvas to contain all rendering results. 197 197 void syncSoftwareCanvas() const; 198 198 #else 199 void pre SoftwareDraw() const {}200 void pre HardwareDraw() const {}199 void prepareForSoftwareDraw() const {} 200 void prepareForHardwareDraw() const {} 201 201 void syncSoftwareCanvas() const {} 202 202 #endif
Note: See TracChangeset
for help on using the changeset viewer.