OLD | NEW |
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 18 matching lines...) Expand all Loading... |
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 "third_party/skia/include/core/SkColorSpace.h" | 36 #include "third_party/skia/include/core/SkColorSpace.h" |
37 #include "third_party/skia/include/core/SkImage.h" | 37 #include "third_party/skia/include/core/SkImage.h" |
38 | 38 |
39 class SkPicture; | |
40 | 39 |
41 namespace blink { | 40 namespace blink { |
42 | 41 |
43 ImageBufferSurface::ImageBufferSurface(const IntSize& size, | 42 ImageBufferSurface::ImageBufferSurface(const IntSize& size, |
44 OpacityMode opacityMode, | 43 OpacityMode opacityMode, |
45 sk_sp<SkColorSpace> colorSpace, | 44 sk_sp<SkColorSpace> colorSpace, |
46 SkColorType colorType) | 45 SkColorType colorType) |
47 : m_opacityMode(opacityMode), | 46 : m_opacityMode(opacityMode), |
48 m_size(size), | 47 m_size(size), |
49 m_colorSpace(colorSpace), | 48 m_colorSpace(colorSpace), |
50 m_colorType(colorType) { | 49 m_colorType(colorType) { |
51 setIsHidden(false); | 50 setIsHidden(false); |
52 } | 51 } |
53 | 52 |
54 ImageBufferSurface::~ImageBufferSurface() {} | 53 ImageBufferSurface::~ImageBufferSurface() {} |
55 | 54 |
56 sk_sp<SkPicture> ImageBufferSurface::getPicture() { | 55 sk_sp<PaintRecord> ImageBufferSurface::getPicture() { |
57 return nullptr; | 56 return nullptr; |
58 } | 57 } |
59 | 58 |
60 void ImageBufferSurface::clear() { | 59 void ImageBufferSurface::clear() { |
61 // Clear the background transparent or opaque, as required. It would be nice | 60 // 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 | 61 // 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? | 62 // transparency color. Can we have another way to manage this? |
64 if (isValid()) { | 63 if (isValid()) { |
65 if (m_opacityMode == Opaque) { | 64 if (m_opacityMode == Opaque) { |
66 canvas()->clear(SK_ColorBLACK); | 65 canvas()->clear(SK_ColorBLACK); |
(...skipping 23 matching lines...) Expand all Loading... |
90 | 89 |
91 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, | 90 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, |
92 const void* pixels, | 91 const void* pixels, |
93 size_t rowBytes, | 92 size_t rowBytes, |
94 int x, | 93 int x, |
95 int y) { | 94 int y) { |
96 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); | 95 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); |
97 } | 96 } |
98 | 97 |
99 } // namespace blink | 98 } // namespace blink |
OLD | NEW |