Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageBufferSurface.cpp

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "platform/graphics/ImageBufferSurface.h" 31 #include "platform/graphics/ImageBufferSurface.h"
32 32
33 #include "platform/graphics/GraphicsContext.h" 33 #include "platform/graphics/GraphicsContext.h"
34 #include "platform/graphics/ImageBuffer.h" 34 #include "platform/graphics/ImageBuffer.h"
35 #include "platform/graphics/StaticBitmapImage.h" 35 #include "platform/graphics/StaticBitmapImage.h"
36 #include "skia/ext/cdl_common.h"
36 #include "third_party/skia/include/core/SkColorSpace.h" 37 #include "third_party/skia/include/core/SkColorSpace.h"
37 #include "third_party/skia/include/core/SkImage.h" 38 #include "third_party/skia/include/core/SkImage.h"
38 39
39 class SkPicture;
40 40
41 namespace blink { 41 namespace blink {
42 42
43 ImageBufferSurface::ImageBufferSurface(const IntSize& size, 43 ImageBufferSurface::ImageBufferSurface(const IntSize& size,
44 OpacityMode opacityMode, 44 OpacityMode opacityMode,
45 sk_sp<SkColorSpace> colorSpace, 45 sk_sp<SkColorSpace> colorSpace,
46 SkColorType colorType) 46 SkColorType colorType)
47 : m_opacityMode(opacityMode), 47 : m_opacityMode(opacityMode),
48 m_size(size), 48 m_size(size),
49 m_colorSpace(colorSpace), 49 m_colorSpace(colorSpace),
50 m_colorType(colorType) { 50 m_colorType(colorType) {
51 setIsHidden(false); 51 setIsHidden(false);
52 } 52 }
53 53
54 ImageBufferSurface::~ImageBufferSurface() {} 54 ImageBufferSurface::~ImageBufferSurface() {}
55 55
56 sk_sp<SkPicture> ImageBufferSurface::getPicture() { 56 sk_sp<CdlPicture> ImageBufferSurface::getPicture() {
57 return nullptr; 57 return nullptr;
58 } 58 }
59 59
60 void ImageBufferSurface::clear() { 60 void ImageBufferSurface::clear() {
61 // Clear the background transparent or opaque, as required. It would be nice 61 // Clear the background transparent or opaque, as required. It would be nice
62 // if this wasn't required, but the canvas is currently filled with the magic 62 // if this wasn't required, but the canvas is currently filled with the magic
63 // transparency color. Can we have another way to manage this? 63 // transparency color. Can we have another way to manage this?
64 if (isValid()) { 64 if (isValid()) {
65 if (m_opacityMode == Opaque) { 65 if (m_opacityMode == Opaque) {
66 canvas()->clear(SK_ColorBLACK); 66 canvas()->clear(SK_ColorBLACK);
(...skipping 23 matching lines...) Expand all
90 90
91 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, 91 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo,
92 const void* pixels, 92 const void* pixels,
93 size_t rowBytes, 93 size_t rowBytes,
94 int x, 94 int x,
95 int y) { 95 int y) {
96 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); 96 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y);
97 } 97 }
98 98
99 } // namespace blink 99 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698