Changeset 64374 in webkit
- Timestamp:
- Jul 30, 2010 2:20:03 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64373 r64374 1 2010-07-30 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [chromium] Make the GLES2 texture map generic and teach ImageSkia and ImageBufferSkia about GLES2 6 https://bugs.webkit.org/show_bug.cgi?id=43218 7 8 This makes the GLES2Canvas' TextureHashMap key on void* instead of NativeImagePtr 9 to make it easier to use with other backends. It also teaches ImageSkia how 10 to draw to a GLES2Canvas instead of a skia buffer. 11 12 No change in functionality (yet), no new tests. 13 14 * platform/graphics/chromium/GLES2Canvas.cpp: 15 (WebCore::GLES2Canvas::GLES2Canvas): 16 (WebCore::GLES2Canvas::createTexture): 17 (WebCore::GLES2Canvas::getTexture): 18 * platform/graphics/chromium/GLES2Canvas.h: 19 * platform/graphics/skia/ImageBufferSkia.cpp: 20 (WebCore::ImageBuffer::getUnmultipliedImageData): 21 (WebCore::ImageBuffer::getPremultipliedImageData): 22 * platform/graphics/skia/ImageSkia.cpp: 23 (WebCore::drawBitmapGLES2): 24 (WebCore::BitmapImage::draw): 25 (WebCore::BitmapImageSingleFrameSkia::draw): 26 1 27 2010-07-30 Yong Li <yoli@rim.com> 2 28 -
trunk/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
r64161 r64374 100 100 m_stateStack.append(State()); 101 101 m_state = &m_stateStack.last(); 102 103 // Force the source over composite mode to be applied. 104 m_lastCompositeOp = CompositeClear; 105 applyCompositeOperator(CompositeSourceOver); 102 106 } 103 107 -
trunk/WebCore/platform/graphics/chromium/GLES2Canvas.h
r64161 r64374 43 43 #include <wtf/HashMap.h> 44 44 #include <wtf/Noncopyable.h> 45 #include <wtf/Vector.h> 45 46 46 47 namespace WebCore { -
trunk/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r64103 r64374 199 199 PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const 200 200 { 201 context()->platformContext()->syncSoftwareCanvas(); 201 202 return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size); 202 203 } … … 204 205 PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const 205 206 { 207 context()->platformContext()->syncSoftwareCanvas(); 206 208 return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size); 207 209 } -
trunk/WebCore/platform/graphics/skia/ImageSkia.cpp
r60658 r64374 48 48 #include "skia/ext/image_operations.h" 49 49 #include "skia/ext/platform_canvas.h" 50 #if USE(GLES2_RENDERING) 51 #include "GLES2Canvas.h" 52 #include "GLES2Context.h" 53 #include "SkPixelRef.h" 54 #endif 50 55 51 56 namespace WebCore { … … 405 410 } 406 411 412 #if USE(GLES2_RENDERING) 413 static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace styleColorSpace, CompositeOperator compositeOp) 414 { 415 ctxt->platformContext()->prepareForHardwareDraw(); 416 GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas(); 417 gpuCanvas->gles2Context()->makeCurrent(); 418 GLES2Texture* texture = gpuCanvas->getTexture(bitmap); 419 if (!texture) { 420 ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config); 421 ASSERT(bitmap->rowBytes() == bitmap->width() * 4); 422 texture = gpuCanvas->createTexture(bitmap, GLES2Texture::BGRA8, bitmap->width(), bitmap->height()); 423 ASSERT(bitmap->pixelRef()); 424 texture->load(bitmap->pixelRef()->pixels()); 425 } 426 gpuCanvas->drawTexturedRect(texture, srcRect, dstRect, styleColorSpace, compositeOp); 427 } 428 #endif 429 407 430 // ================================================ 408 431 // BitmapImage Class … … 430 453 431 454 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, 432 const FloatRect& srcRect, ColorSpace , CompositeOperator compositeOp)455 const FloatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp) 433 456 { 434 457 if (!m_source.initialized()) … … 440 463 startAnimation(); 441 464 442 constNativeImageSkia* bm = nativeImageForCurrentFrame();465 NativeImageSkia* bm = nativeImageForCurrentFrame(); 443 466 if (!bm) 444 467 return; // It's too early and we don't have an image yet. 445 468 469 #if USE(GLES2_RENDERING) 470 if (ctxt->platformContext()->useGPU()) { 471 drawBitmapGLES2(ctxt, bm, srcRect, dstRect, colorSpace, compositeOp); 472 return; 473 } 474 #endif 446 475 FloatRect normDstRect = normalizeRect(dstRect); 447 476 FloatRect normSrcRect = normalizeRect(srcRect); … … 449 478 if (normSrcRect.isEmpty() || normDstRect.isEmpty()) 450 479 return; // Nothing to draw. 480 481 ctxt->platformContext()->prepareForSoftwareDraw(); 451 482 452 483 paintSkBitmap(ctxt->platformContext(), … … 471 502 return; // Nothing to draw. 472 503 504 #if USE(GLES2_RENDERING) 505 if (ctxt->platformContext()->useGPU()) { 506 drawBitmapGLES2(ctxt, &m_nativeImage, srcRect, dstRect, styleColorSpace, compositeOp); 507 return; 508 } 509 #endif 510 511 ctxt->platformContext()->prepareForSoftwareDraw(); 512 473 513 paintSkBitmap(ctxt->platformContext(), 474 514 m_nativeImage,
Note: See TracChangeset
for help on using the changeset viewer.