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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.h

Issue 2785203002: Split Gradient impl into separate classes (Closed)
Patch Set: review Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 #ifndef BaseRenderingContext2D_h 5 #ifndef BaseRenderingContext2D_h
6 #define BaseRenderingContext2D_h 6 #define BaseRenderingContext2D_h
7 7
8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h" 8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h"
9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h" 9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return false; 389 return false;
390 390
391 SkIRect clipBounds; 391 SkIRect clipBounds;
392 if (!drawingCanvas() || !drawingCanvas()->getDeviceClipBounds(&clipBounds)) 392 if (!drawingCanvas() || !drawingCanvas()->getDeviceClipBounds(&clipBounds))
393 return false; 393 return false;
394 394
395 // If gradient size is zero, then paint nothing. 395 // If gradient size is zero, then paint nothing.
396 CanvasStyle* style = state().style(paintType); 396 CanvasStyle* style = state().style(paintType);
397 if (style) { 397 if (style) {
398 CanvasGradient* gradient = style->getCanvasGradient(); 398 CanvasGradient* gradient = style->getCanvasGradient();
399 if (gradient && gradient->getGradient()->isZeroSize()) 399 if (gradient && gradient->isZeroSize())
400 return false; 400 return false;
401 } 401 }
402 402
403 if (isFullCanvasCompositeMode(state().globalComposite()) || 403 if (isFullCanvasCompositeMode(state().globalComposite()) ||
404 stateHasFilter()) { 404 stateHasFilter()) {
405 compositedDraw(drawFunc, drawingCanvas(), paintType, imageType); 405 compositedDraw(drawFunc, drawingCanvas(), paintType, imageType);
406 didDraw(clipBounds); 406 didDraw(clipBounds);
407 } else if (state().globalComposite() == SkBlendMode::kSrc) { 407 } else if (state().globalComposite() == SkBlendMode::kSrc) {
408 clearCanvas(); // takes care of checkOverdraw() 408 clearCanvas(); // takes care of checkOverdraw()
409 const PaintFlags* flags = 409 const PaintFlags* flags =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); 468 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver);
469 c->setMatrix(ctm); 469 c->setMatrix(ctm);
470 drawFunc(c, &foregroundFlags); 470 drawFunc(c, &foregroundFlags);
471 c->restore(); 471 c->restore();
472 c->setMatrix(ctm); 472 c->setMatrix(ctm);
473 } 473 }
474 474
475 } // namespace blink 475 } // namespace blink
476 476
477 #endif // BaseRenderingContext2D_h 477 #endif // BaseRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698