Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 | 258 |
| 259 return result; | 259 return result; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect* srcPtr, CompositeOperator op, WebBlendMode blendMode) | 262 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect* srcPtr, CompositeOperator op, WebBlendMode blendMode) |
| 263 { | 263 { |
| 264 if (!isSurfaceValid()) | 264 if (!isSurfaceValid()) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); | 267 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); |
| 268 RefPtr<SkPicture> picture = m_surface->getPicture(); | 268 RefPtr<SkPicture> picture = m_surface->getPicture(); |
|
Stephen White
2014/12/12 22:14:12
IWBN if the SkPicture-related stuff could all live
Justin Novosad
2014/12/12 22:31:51
Acknowledged.
| |
| 269 if (picture) { | 269 if (picture) { |
| 270 context->drawPicture(picture.get(), destRect, srcRect, op, blendMode); | 270 context->compositePicture(picture.get(), destRect, srcRect, op, blendMod e); |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 | 273 |
| 274 SkBitmap bitmap = m_surface->bitmap(); | 274 SkBitmap bitmap = m_surface->bitmap(); |
| 275 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f or CPU side usage | 275 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f or CPU side usage |
| 276 // if it is available, otherwise generate and use it. | 276 // if it is available, otherwise generate and use it. |
| 277 if (!context->isAccelerated() && m_surface->isAccelerated() && m_surface->ca chedBitmapEnabled() && isSurfaceValid()) { | 277 if (!context->isAccelerated() && m_surface->isAccelerated() && m_surface->ca chedBitmapEnabled() && isSurfaceValid()) { |
| 278 m_surface->updateCachedBitmapIfNeeded(); | 278 m_surface->updateCachedBitmapIfNeeded(); |
| 279 bitmap = m_surface->cachedBitmap(); | 279 bitmap = m_surface->cachedBitmap(); |
| 280 } | 280 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 | 410 |
| 411 String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con st | 411 String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con st |
| 412 { | 412 { |
| 413 if (!isSurfaceValid()) | 413 if (!isSurfaceValid()) |
| 414 return "data:,"; | 414 return "data:,"; |
| 415 | 415 |
| 416 return ImageEncoder::toDataURL(m_surface->bitmap(), mimeType, quality); | 416 return ImageEncoder::toDataURL(m_surface->bitmap(), mimeType, quality); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace blink | 419 } // namespace blink |
| OLD | NEW |