Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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/gpu/AcceleratedImageBufferSurface.h" | 31 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
| 32 | 32 |
| 33 #include "platform/RuntimeEnabledFeatures.h" | |
| 33 #include "platform/graphics/gpu/SharedGpuContext.h" | 34 #include "platform/graphics/gpu/SharedGpuContext.h" |
| 34 #include "platform/graphics/skia/SkiaUtils.h" | 35 #include "platform/graphics/skia/SkiaUtils.h" |
| 35 #include "platform/wtf/PtrUtil.h" | 36 #include "platform/wtf/PtrUtil.h" |
| 36 #include "platform/wtf/RefPtr.h" | 37 #include "platform/wtf/RefPtr.h" |
| 37 #include "skia/ext/texture_handle.h" | 38 #include "skia/ext/texture_handle.h" |
| 38 #include "third_party/skia/include/gpu/GrContext.h" | 39 #include "third_party/skia/include/gpu/GrContext.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 AcceleratedImageBufferSurface::AcceleratedImageBufferSurface( | 43 AcceleratedImageBufferSurface::AcceleratedImageBufferSurface( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 55 SkImageInfo info = SkImageInfo::Make( | 56 SkImageInfo info = SkImageInfo::Make( |
| 56 size.Width(), size.Height(), color_params.GetSkColorType(), alpha_type, | 57 size.Width(), size.Height(), color_params.GetSkColorType(), alpha_type, |
| 57 color_params.GetSkColorSpaceForSkSurfaces()); | 58 color_params.GetSkColorSpaceForSkSurfaces()); |
| 58 SkSurfaceProps disable_lcd_props(0, kUnknown_SkPixelGeometry); | 59 SkSurfaceProps disable_lcd_props(0, kUnknown_SkPixelGeometry); |
| 59 surface_ = SkSurface::MakeRenderTarget( | 60 surface_ = SkSurface::MakeRenderTarget( |
| 60 gr_context, SkBudgeted::kYes, info, 0 /* sampleCount */, | 61 gr_context, SkBudgeted::kYes, info, 0 /* sampleCount */, |
| 61 kOpaque == opacity_mode ? nullptr : &disable_lcd_props); | 62 kOpaque == opacity_mode ? nullptr : &disable_lcd_props); |
| 62 if (!surface_) | 63 if (!surface_) |
| 63 return; | 64 return; |
| 64 | 65 |
| 65 canvas_ = WTF::WrapUnique(new SkiaPaintCanvas(surface_->getCanvas())); | 66 canvas_ = WTF::WrapUnique(new SkiaPaintCanvas( |
| 67 surface_->getCanvas(), | |
| 68 RuntimeEnabledFeatures::colorCorrectRenderingEnabled() && | |
|
Justin Novosad
2017/05/29 14:45:35
Why is this needed? This calss is not used for ras
ccameron
2017/05/29 15:27:17
This looked like the right behavior for offscreen
| |
| 69 color_params.UsesOutputSpaceBlending() | |
| 70 ? color_params.GetSkColorSpace() | |
| 71 : nullptr)); | |
| 66 Clear(); | 72 Clear(); |
| 67 | 73 |
| 68 // Always save an initial frame, to support resetting the top level matrix | 74 // Always save an initial frame, to support resetting the top level matrix |
| 69 // and clip. | 75 // and clip. |
| 70 canvas_->save(); | 76 canvas_->save(); |
| 71 } | 77 } |
| 72 | 78 |
| 73 bool AcceleratedImageBufferSurface::IsValid() const { | 79 bool AcceleratedImageBufferSurface::IsValid() const { |
| 74 return surface_ && SharedGpuContext::IsValid() && | 80 return surface_ && SharedGpuContext::IsValid() && |
| 75 context_id_ == SharedGpuContext::ContextId(); | 81 context_id_ == SharedGpuContext::ContextId(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 91 | 97 |
| 92 bool AcceleratedImageBufferSurface::WritePixels(const SkImageInfo& orig_info, | 98 bool AcceleratedImageBufferSurface::WritePixels(const SkImageInfo& orig_info, |
| 93 const void* pixels, | 99 const void* pixels, |
| 94 size_t row_bytes, | 100 size_t row_bytes, |
| 95 int x, | 101 int x, |
| 96 int y) { | 102 int y) { |
| 97 return surface_->getCanvas()->writePixels(orig_info, pixels, row_bytes, x, y); | 103 return surface_->getCanvas()->writePixels(orig_info, pixels, row_bytes, x, y); |
| 98 } | 104 } |
| 99 | 105 |
| 100 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |