Changeset 95192 in webkit
- Timestamp:
- Sep 15, 2011 8:13:15 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95184 r95192 1 2011-09-15 Brian Salomon <bsalomon@google.com> 2 3 [Skia/Chrome] Cleanup unneeded code now that GrGLInterface is used to set GL ctx per GL call. 4 https://bugs.webkit.org/show_bug.cgi?id=68096 5 6 Reviewed by Stephen White. 7 8 This change removes PlatformContextSkia::makeGrContextCurrent now that 9 GrGLInterface is used to set the context on every Skia GL call. 10 11 Tested by every canvas layout test. 12 13 * platform/graphics/chromium/FontLinux.cpp: 14 (WebCore::Font::drawGlyphs): 15 * platform/graphics/skia/FontSkia.cpp: 16 (WebCore::Font::drawGlyphs): 17 * platform/graphics/skia/GraphicsContextSkia.cpp: 18 (WebCore::GraphicsContext::clearRect): 19 (WebCore::GraphicsContext::clip): 20 (WebCore::GraphicsContext::drawConvexPolygon): 21 (WebCore::GraphicsContext::drawEllipse): 22 (WebCore::GraphicsContext::drawFocusRing): 23 (WebCore::GraphicsContext::drawLine): 24 (WebCore::GraphicsContext::drawLineForTextChecking): 25 (WebCore::GraphicsContext::drawLineForText): 26 (WebCore::GraphicsContext::drawRect): 27 (WebCore::GraphicsContext::fillPath): 28 (WebCore::GraphicsContext::fillRect): 29 (WebCore::GraphicsContext::fillRoundedRect): 30 (WebCore::GraphicsContext::strokeArc): 31 (WebCore::GraphicsContext::strokePath): 32 (WebCore::GraphicsContext::strokeRect): 33 * platform/graphics/skia/ImageBufferSkia.cpp: 34 (WebCore::ImageBuffer::ImageBuffer): 35 (WebCore::ImageBuffer::~ImageBuffer): 36 (WebCore::ImageBuffer::copyImage): 37 (WebCore::ImageBuffer::draw): 38 (WebCore::ImageBuffer::drawPattern): 39 (WebCore::ImageBuffer::getUnmultipliedImageData): 40 (WebCore::ImageBuffer::getPremultipliedImageData): 41 (WebCore::ImageBuffer::putUnmultipliedImageData): 42 (WebCore::ImageBuffer::putPremultipliedImageData): 43 (WebCore::ImageBuffer::toDataURL): 44 * platform/graphics/skia/ImageSkia.cpp: 45 (WebCore::BitmapImage::draw): 46 (WebCore::BitmapImageSingleFrameSkia::draw): 47 * platform/graphics/skia/PlatformContextSkia.cpp: 48 (WebCore::PlatformContextSkia::clipPathAntiAliased): 49 (WebCore::PlatformContextSkia::setGraphicsContext3D): 50 * platform/graphics/skia/PlatformContextSkia.h: 51 * platform/graphics/skia/SkiaFontWin.cpp: 52 (WebCore::paintSkiaText): 53 1 54 2011-09-15 Peter Beverloo <peter@chromium.org> 2 55 -
trunk/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
r90872 r95192 111 111 } 112 112 113 gc->platformContext()->makeGrContextCurrent();114 115 113 SkCanvas* canvas = gc->platformContext()->canvas(); 116 114 TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode(); -
trunk/Source/WebCore/platform/graphics/skia/FontSkia.cpp
r94019 r95192 127 127 } 128 128 129 gc->platformContext()->makeGrContextCurrent();130 131 129 SkCanvas* canvas = gc->platformContext()->canvas(); 132 130 TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode(); -
trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r94897 r95192 336 336 ClipRectToCanvas(*platformContext()->canvas(), r, &r); 337 337 338 platformContext()->makeGrContextCurrent();339 340 338 SkPaint paint; 341 339 platformContext()->setupPaintForFilling(&paint); … … 353 351 return; 354 352 355 platformContext()->makeGrContextCurrent();356 353 platformContext()->canvas()->clipRect(r); 357 354 } … … 457 454 return; 458 455 459 platformContext()->makeGrContextCurrent();460 461 456 SkPath path; 462 457 setPathFromConvexPoints(&path, numPoints, points); … … 506 501 return; 507 502 508 platformContext()->makeGrContextCurrent();509 503 SkPaint paint; 510 504 platformContext()->setupPaintForFilling(&paint); … … 563 557 return; 564 558 565 platformContext()->makeGrContextCurrent();566 559 SkRegion focusRingRegion; 567 560 const SkScalar focusRingOutset = getFocusRingOutset(width); … … 597 590 if (!isPointSkiaSafe(getCTM(), point1) || !isPointSkiaSafe(getCTM(), point2)) 598 591 return; 599 600 platformContext()->makeGrContextCurrent();601 592 602 593 FloatPoint p1 = point1; … … 643 634 if (paintingDisabled()) 644 635 return; 645 646 platformContext()->makeGrContextCurrent();647 636 648 637 // Create the pattern we'll use to draw the underline. … … 726 715 return; 727 716 728 platformContext()->makeGrContextCurrent();729 730 717 int thickness = SkMax32(static_cast<int>(strokeThickness()), 1); 731 718 SkRect r; … … 748 735 return; 749 736 750 platformContext()->makeGrContextCurrent();751 752 737 SkRect r = rect; 753 738 if (!isRectSkiaSafe(getCTM(), r)) { … … 768 753 return; 769 754 770 platformContext()->makeGrContextCurrent();771 772 755 const GraphicsContextState& state = m_state; 773 756 path.setFillType(state.fillRule == RULE_EVENODD ? … … 793 776 platformContext()->save(); 794 777 795 platformContext()->makeGrContextCurrent();796 797 778 SkPaint paint; 798 779 platformContext()->setupPaintForFilling(&paint); … … 806 787 if (paintingDisabled()) 807 788 return; 808 809 platformContext()->makeGrContextCurrent();810 789 811 790 SkRect r = rect; … … 841 820 return; 842 821 843 platformContext()->makeGrContextCurrent();844 845 822 SkRect r = rect; 846 823 if (!isRectSkiaSafe(getCTM(), r)) … … 1130 1107 return; 1131 1108 1132 platformContext()->makeGrContextCurrent();1133 1134 1109 SkPaint paint; 1135 1110 SkRect oval = r; … … 1163 1138 return; 1164 1139 1165 platformContext()->makeGrContextCurrent();1166 1167 1140 SkPaint paint; 1168 1141 platformContext()->setupPaintForStroking(&paint, 0, 0); … … 1177 1150 if (!isRectSkiaSafe(getCTM(), rect)) 1178 1151 return; 1179 1180 platformContext()->makeGrContextCurrent();1181 1152 1182 1153 SkPaint paint; -
trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r95177 r95192 87 87 GraphicsContext3D* context3D = SharedGraphicsContext3D::create(0); 88 88 if (context3D) { 89 context3D->makeContextCurrent();90 89 GrContext* gr = context3D->grContext(); 91 90 if (gr) { … … 119 118 m_data.m_platformLayer->setTextureId(0); 120 119 #endif 121 if (m_context && m_context->platformContext()) {122 // This is so that the SkGpuDevice destructor has the correct context.123 m_context->platformContext()->makeGrContextCurrent();124 }125 120 } 126 121 … … 138 133 { 139 134 ASSERT(copyBehavior == CopyBackingStore); 140 m_context->platformContext()->makeGrContextCurrent();141 135 return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true); 142 136 } … … 155 149 CompositeOperator op, bool useLowQualityScale) 156 150 { 157 // Set both graphics contexts current. This looks a little weird, but is158 // necessary since we may be drawing from an accelerated to159 // non-accelerated context (e.g., printing), or vice versa. Note that it160 // only works because the context is actually the same underlying context161 // (or null), since we use one context for accelerated drawing. If that162 // assumption changes, we'll have to revisit this code.163 context->platformContext()->makeGrContextCurrent();164 m_context->platformContext()->makeGrContextCurrent();165 151 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context); 166 152 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); … … 170 156 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) 171 157 { 172 context->platformContext()->makeGrContextCurrent();173 158 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context); 174 159 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); … … 287 272 PassRefPtr<ByteArray> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const 288 273 { 289 m_context->platformContext()->makeGrContextCurrent();290 274 return getImageData<Unmultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size); 291 275 } … … 293 277 PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const 294 278 { 295 m_context->platformContext()->makeGrContextCurrent();296 279 return getImageData<Premultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size); 297 280 } … … 368 351 void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 369 352 { 370 m_context->platformContext()->makeGrContextCurrent();371 353 putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size); 372 354 } … … 374 356 void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 375 357 { 376 m_context->platformContext()->makeGrContextCurrent();377 358 putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size); 378 359 } … … 404 385 String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const 405 386 { 406 m_context->platformContext()->makeGrContextCurrent();407 387 SkDevice* device = context()->platformContext()->canvas()->getDevice(); 408 388 return ImageToDataURL(device->accessBitmap(false), mimeType, quality); -
trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp
r94185 r95192 423 423 return; // Nothing to draw. 424 424 425 ctxt->platformContext()->makeGrContextCurrent();426 427 425 paintSkBitmap(ctxt->platformContext(), 428 426 *bm, … … 449 447 return; // Nothing to draw. 450 448 451 ctxt->platformContext()->makeGrContextCurrent();452 453 449 paintSkBitmap(ctxt->platformContext(), 454 450 m_nativeImage, -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r94589 r95192 268 268 void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath) 269 269 { 270 makeGrContextCurrent();271 270 if (m_canvas->getTopDevice()->getDeviceCapabilities() & SkDevice::kVector_Capability) { 272 271 // When the output is a vector device, like PDF, we don't need antialiased clips. … … 657 656 } 658 657 659 void PlatformContextSkia::makeGrContextCurrent()660 {661 if (m_gpuContext)662 m_gpuContext->makeContextCurrent();663 }664 665 658 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
r94589 r95192 175 175 bool isAccelerated() const { return m_gpuContext; } 176 176 void setGraphicsContext3D(GraphicsContext3D*); 177 void makeGrContextCurrent();178 177 179 178 private: -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp
r95097 r95192 184 184 TextDrawingModeFlags textMode = platformContext->getTextDrawingMode(); 185 185 186 // If platformContext is GPU-backed make its GL context current.187 platformContext->makeGrContextCurrent();188 189 186 // Filling (if necessary). This is the common case. 190 187 SkPaint paint; -
trunk/Source/WebKit/chromium/ChangeLog
r95188 r95192 1 2011-09-15 Brian Salomon <bsalomon@google.com> 2 3 [Skia/Chrome] 4 https://bugs.webkit.org/show_bug.cgi?id=68096 5 6 This change removes WebGraphicsContext3D::grGLInterface(). It has been 7 superceded by WebGraphicsContext3D::createGrGLInterface which sets up 8 the per-GL call callback used to set the correct context. 9 10 Reviewed by Stephen White. 11 12 * public/WebGraphicsContext3D.h: 13 * src/GraphicsContext3DChromium.cpp: 14 (WebCore::GraphicsContext3DPrivate::grContext): 15 * src/WebGraphicsContext3D.cpp: 16 (WebKit::WebGraphicsContext3D::createGrGLInterface): 17 1 18 2011-09-15 Xianzhu Wang <wangxianzhu@chromium.org> 2 19 -
trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h
r94971 r95192 367 367 368 368 #if WEBKIT_USING_SKIA 369 // FIXME: This function is superceded by onCreateGrGLInterface. It should be removed after subclass implementations are removed from Chromium.370 virtual GrGLInterface* grGLInterface() { return 0; }371 372 369 GrGLInterface* createGrGLInterface(); 373 370 #endif -
trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
r95156 r95192 203 203 if (!m_grContext) { 204 204 SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface()); 205 // FIXME: Remove this block after the WebGraphicsContext3D subclasses in Chromium no longer override grGLInterface().206 if (!interface.get()) {207 GrGLInterface* fallbackInterface = m_impl->grGLInterface();208 if (fallbackInterface) {209 fallbackInterface->ref(); // balance out the SkAutoTUnref210 interface.reset(fallbackInterface);211 }212 }213 // This is the end of the block to remove.214 205 m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get())); 215 206 if (m_grContext) -
trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp
r94359 r95192 33 33 #if WEBKIT_USING_SKIA 34 34 35 #if GR_GL_PER_GL_FUNC_CALLBACK36 35 namespace { 37 36 void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface) … … 40 39 } 41 40 } 42 #endif43 41 44 42 GrGLInterface* WebGraphicsContext3D::createGrGLInterface() 45 43 { 46 44 GrGLInterface* interface = onCreateGrGLInterface(); 47 #if GR_GL_PER_GL_FUNC_CALLBACK48 45 if (interface) { 49 46 interface->fCallback = bindWebGraphicsContext3DGLContextCallback; 50 47 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); 51 48 } 52 #endif53 49 return interface; 54 50 }
Note: See TracChangeset
for help on using the changeset viewer.