| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" | 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (!m_imageBuffer) | 169 if (!m_imageBuffer) |
| 170 return AffineTransform(); // identity | 170 return AffineTransform(); // identity |
| 171 return m_imageBuffer->baseTransform(); | 171 return m_imageBuffer->baseTransform(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void OffscreenCanvasRenderingContext2D::didDraw(const SkIRect& dirtyRect) | 174 void OffscreenCanvasRenderingContext2D::didDraw(const SkIRect& dirtyRect) |
| 175 { } | 175 { } |
| 176 | 176 |
| 177 bool OffscreenCanvasRenderingContext2D::stateHasFilter() | 177 bool OffscreenCanvasRenderingContext2D::stateHasFilter() |
| 178 { | 178 { |
| 179 // TODO: crbug.com/593838 make hasFilter accept nullptr | 179 return state().hasFilter(nullptr, getOffscreenCanvas()->size(), nullptr); |
| 180 // return state().hasFilter(nullptr, nullptr, IntSize(width(), height()), th
is); | |
| 181 return false; | |
| 182 } | 180 } |
| 183 | 181 |
| 184 SkImageFilter* OffscreenCanvasRenderingContext2D::stateGetFilter() | 182 SkImageFilter* OffscreenCanvasRenderingContext2D::stateGetFilter() |
| 185 { | 183 { |
| 186 // TODO: make getFilter accept nullptr | 184 SkImageFilter* f = state().getFilter(nullptr, getOffscreenCanvas()->size(),
nullptr); |
| 187 // return state().getFilter(nullptr, nullptr, IntSize(width(), height()), th
is); | 185 return f; |
| 188 return nullptr; | 186 } |
| 187 |
| 188 void OffscreenCanvasRenderingContext2D::setFilter(const String& filterString) |
| 189 { |
| 190 BaseRenderingContext2D::setFilter(filterString); |
| 189 } | 191 } |
| 190 | 192 |
| 191 void OffscreenCanvasRenderingContext2D::validateStateStack() | 193 void OffscreenCanvasRenderingContext2D::validateStateStack() |
| 192 { | 194 { |
| 193 #if ENABLE(ASSERT) | 195 #if ENABLE(ASSERT) |
| 194 SkCanvas* skCanvas = existingDrawingCanvas(); | 196 SkCanvas* skCanvas = existingDrawingCanvas(); |
| 195 if (skCanvas) { | 197 if (skCanvas) { |
| 196 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz
e()); | 198 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz
e()); |
| 197 } | 199 } |
| 198 #endif | 200 #endif |
| 199 } | 201 } |
| 200 | 202 |
| 201 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 203 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
| 202 { | 204 { |
| 203 return false; | 205 return false; |
| 204 } | 206 } |
| 205 | 207 |
| 206 bool OffscreenCanvasRenderingContext2D::isPaintable() const | 208 bool OffscreenCanvasRenderingContext2D::isPaintable() const |
| 207 { | 209 { |
| 208 return this->imageBuffer(); | 210 return this->imageBuffer(); |
| 209 } | 211 } |
| 210 } | 212 } |
| OLD | NEW |