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

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

Issue 2797213002: Fix BaseRenderingContext2D create/put/get-ImageData() for color managed canvas (Closed)
Patch Set: Rebaseline 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"
11 #include "core/html/canvas/CanvasRenderingContext.h"
fserb 2017/04/11 03:21:44 no need for this anymore.
zakerinasab 2017/04/11 19:52:59 Done.
11 #include "modules/ModulesExport.h" 12 #include "modules/ModulesExport.h"
12 #include "modules/canvas2d/CanvasGradient.h" 13 #include "modules/canvas2d/CanvasGradient.h"
13 #include "modules/canvas2d/CanvasPathMethods.h" 14 #include "modules/canvas2d/CanvasPathMethods.h"
14 #include "modules/canvas2d/CanvasRenderingContext2DState.h" 15 #include "modules/canvas2d/CanvasRenderingContext2DState.h"
15 #include "modules/canvas2d/CanvasStyle.h" 16 #include "modules/canvas2d/CanvasStyle.h"
16 #include "platform/graphics/ColorBehavior.h" 17 #include "platform/graphics/ColorBehavior.h"
17 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 18 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
18 #include "platform/graphics/paint/PaintCanvas.h" 19 #include "platform/graphics/paint/PaintCanvas.h"
19 #include "third_party/skia/include/effects/SkComposeImageFilter.h" 20 #include "third_party/skia/include/effects/SkComposeImageFilter.h"
20 21
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 virtual void ValidateStateStack() const = 0; 232 virtual void ValidateStateStack() const = 0;
232 233
233 virtual bool HasAlpha() const = 0; 234 virtual bool HasAlpha() const = 0;
234 235
235 virtual bool isContextLost() const = 0; 236 virtual bool isContextLost() const = 0;
236 237
237 virtual ColorBehavior DrawImageColorBehavior() const = 0; 238 virtual ColorBehavior DrawImageColorBehavior() const = 0;
238 239
239 virtual void WillDrawImage(CanvasImageSource*) const {} 240 virtual void WillDrawImage(CanvasImageSource*) const {}
240 241
242 virtual CanvasColorSpace ColorSpace() const {
243 return kLegacyCanvasColorSpace;
244 };
245 virtual String ColorSpaceAsString() const {
246 return kLegacyCanvasColorSpaceName;
247 }
248 virtual CanvasPixelFormat PixelFormat() const {
249 return kRGBA8CanvasPixelFormat;
250 }
251
241 void RestoreMatrixClipStack(PaintCanvas*) const; 252 void RestoreMatrixClipStack(PaintCanvas*) const;
242 253
243 DECLARE_VIRTUAL_TRACE(); 254 DECLARE_VIRTUAL_TRACE();
244 255
245 enum DrawCallType { 256 enum DrawCallType {
246 kStrokePath = 0, 257 kStrokePath = 0,
247 kFillPath, 258 kFillPath,
248 kDrawVectorImage, 259 kDrawVectorImage,
249 kDrawBitmapImage, 260 kDrawBitmapImage,
250 kFillText, 261 kFillText,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 static bool IsFullCanvasCompositeMode(SkBlendMode); 376 static bool IsFullCanvasCompositeMode(SkBlendMode);
366 377
367 template <typename DrawFunc> 378 template <typename DrawFunc>
368 void CompositedDraw(const DrawFunc&, 379 void CompositedDraw(const DrawFunc&,
369 PaintCanvas*, 380 PaintCanvas*,
370 CanvasRenderingContext2DState::PaintType, 381 CanvasRenderingContext2DState::PaintType,
371 CanvasRenderingContext2DState::ImageType); 382 CanvasRenderingContext2DState::ImageType);
372 383
373 void ClearCanvas(); 384 void ClearCanvas();
374 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const; 385 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const;
386
387 bool ColorSettingsAsImageDataColorSettings(ImageDataColorSettings&) const;
fserb 2017/04/11 03:21:44 can we name this with a verb? Do you mean somethin
zakerinasab 2017/04/11 19:52:59 This method converts the canvas color settings (if
388
389 bool is_color_managed_;
375 }; 390 };
376 391
377 template <typename DrawFunc, typename ContainsFunc> 392 template <typename DrawFunc, typename ContainsFunc>
378 bool BaseRenderingContext2D::Draw( 393 bool BaseRenderingContext2D::Draw(
379 const DrawFunc& draw_func, 394 const DrawFunc& draw_func,
380 const ContainsFunc& draw_covers_clip_bounds, 395 const ContainsFunc& draw_covers_clip_bounds,
381 const SkRect& bounds, 396 const SkRect& bounds,
382 CanvasRenderingContext2DState::PaintType paint_type, 397 CanvasRenderingContext2DState::PaintType paint_type,
383 CanvasRenderingContext2DState::ImageType image_type) { 398 CanvasRenderingContext2DState::ImageType image_type) {
384 if (!GetState().IsTransformInvertible()) 399 if (!GetState().IsTransformInvertible())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 foreground_flags.setBlendMode(SkBlendMode::kSrcOver); 479 foreground_flags.setBlendMode(SkBlendMode::kSrcOver);
465 c->setMatrix(ctm); 480 c->setMatrix(ctm);
466 draw_func(c, &foreground_flags); 481 draw_func(c, &foreground_flags);
467 c->restore(); 482 c->restore();
468 c->setMatrix(ctm); 483 c->setMatrix(ctm);
469 } 484 }
470 485
471 } // namespace blink 486 } // namespace blink
472 487
473 #endif // BaseRenderingContext2D_h 488 #endif // BaseRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698