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

Unified Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp

Issue 2326633002: Adds filter support for offscreen canvas (Closed)
Patch Set: New version without StyleResolver Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
index b35ffa2c3ad31c1e7f0e6f57af726f79945c63cb..cee863b4c3cc7f216a6821e3fc2871d06f132f1f 100644
--- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
@@ -50,10 +50,10 @@ void OffscreenCanvasRenderingContext2D::commit(ExceptionState& exceptionState) {
// If an OffscreenCanvas has no associated canvas Id, it indicates that
// it is not an OffscreenCanvas created by transfering control from html
// canvas.
- exceptionState.throwDOMException(InvalidStateError,
- "Commit() was called on a context whose "
- "OffscreenCanvas is not associated with a "
- "canvas element.");
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "Commit() was called on a context whose OffscreenCanvas is not "
+ "associated with a canvas element.");
return;
}
double commitStartTime = WTF::monotonicallyIncreasingTime();
@@ -75,9 +75,9 @@ bool OffscreenCanvasRenderingContext2D::wouldTaintOrigin(
CanvasImageSource* source,
ExecutionContext* executionContext) {
if (executionContext->isWorkerGlobalScope()) {
- // We only support passing in ImageBitmap and OffscreenCanvases as source
- // images in drawImage() or createPattern() in a OffscreenCanvas2d in
- // worker.
+ // We only support passing in ImageBitmap and OffscreenCanvases as
+ // source images in drawImage() or createPattern() in a
+ // OffscreenCanvas2d in worker.
DCHECK(source->isImageBitmap() || source->isOffscreenCanvas());
}
@@ -194,17 +194,17 @@ AffineTransform OffscreenCanvasRenderingContext2D::baseTransform() const {
void OffscreenCanvasRenderingContext2D::didDraw(const SkIRect& dirtyRect) {}
bool OffscreenCanvasRenderingContext2D::stateHasFilter() {
- // TODO: crbug.com/593838 make hasFilter accept nullptr
- // return state().hasFilter(nullptr, nullptr, IntSize(width(), height()),
- // this);
- return false;
+ return state().hasFilterWithoutDocument(getOffscreenCanvas()->size());
}
SkImageFilter* OffscreenCanvasRenderingContext2D::stateGetFilter() {
- // TODO: make getFilter accept nullptr
- // return state().getFilter(nullptr, nullptr, IntSize(width(), height()),
- // this);
- return nullptr;
+ SkImageFilter* f =
+ state().getFilterWithoutDocument(getOffscreenCanvas()->size());
+ return f;
meade_UTC10 2016/10/26 06:57:34 Nit: This could just be return state().getFilterW
fserb 2016/10/26 19:08:26 done.
+}
+
+void OffscreenCanvasRenderingContext2D::setFilter(const String& filterString) {
+ BaseRenderingContext2D::setFilter(filterString);
}
void OffscreenCanvasRenderingContext2D::validateStateStack() const {

Powered by Google App Engine
This is Rietveld 408576698