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

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, 7 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 const CanvasImageSourceUnion&, 180 const CanvasImageSourceUnion&,
181 const String& repetition_type, 181 const String& repetition_type,
182 ExceptionState&); 182 ExceptionState&);
183 CanvasPattern* createPattern(ScriptState*, 183 CanvasPattern* createPattern(ScriptState*,
184 CanvasImageSource*, 184 CanvasImageSource*,
185 const String& repetition_type, 185 const String& repetition_type,
186 ExceptionState&); 186 ExceptionState&);
187 187
188 ImageData* createImageData(ImageData*, ExceptionState&) const; 188 ImageData* createImageData(ImageData*, ExceptionState&) const;
189 ImageData* createImageData(int width, int height, ExceptionState&) const; 189 ImageData* createImageData(int width, int height, ExceptionState&) const;
190 ImageData* createImageData(unsigned,
191 unsigned,
192 ImageDataColorSettings&,
193 ExceptionState&) const;
194 ImageData* createImageData(ImageDataArray&,
195 unsigned,
196 unsigned,
197 ExceptionState&) const;
198 ImageData* createImageData(ImageDataArray&,
199 unsigned,
200 unsigned,
201 ImageDataColorSettings&,
202 ExceptionState&) const;
203
190 ImageData* getImageData(int sx, int sy, int sw, int sh, ExceptionState&); 204 ImageData* getImageData(int sx, int sy, int sw, int sh, ExceptionState&);
191 void putImageData(ImageData*, int dx, int dy, ExceptionState&); 205 void putImageData(ImageData*, int dx, int dy, ExceptionState&);
192 void putImageData(ImageData*, 206 void putImageData(ImageData*,
193 int dx, 207 int dx,
194 int dy, 208 int dy,
195 int dirty_x, 209 int dirty_x,
196 int dirty_y, 210 int dirty_y,
197 int dirty_width, 211 int dirty_width,
198 int dirty_height, 212 int dirty_height,
199 ExceptionState&); 213 ExceptionState&);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 virtual void ValidateStateStack() const = 0; 245 virtual void ValidateStateStack() const = 0;
232 246
233 virtual bool HasAlpha() const = 0; 247 virtual bool HasAlpha() const = 0;
234 248
235 virtual bool isContextLost() const = 0; 249 virtual bool isContextLost() const = 0;
236 250
237 virtual ColorBehavior DrawImageColorBehavior() const = 0; 251 virtual ColorBehavior DrawImageColorBehavior() const = 0;
238 252
239 virtual void WillDrawImage(CanvasImageSource*) const {} 253 virtual void WillDrawImage(CanvasImageSource*) const {}
240 254
255 virtual CanvasColorSpace ColorSpace() const {
256 return kLegacyCanvasColorSpace;
257 };
258 virtual String ColorSpaceAsString() const {
259 return kLegacyCanvasColorSpaceName;
260 }
261 virtual CanvasPixelFormat PixelFormat() const {
262 return kRGBA8CanvasPixelFormat;
263 }
264
241 void RestoreMatrixClipStack(PaintCanvas*) const; 265 void RestoreMatrixClipStack(PaintCanvas*) const;
242 266
243 DECLARE_VIRTUAL_TRACE(); 267 DECLARE_VIRTUAL_TRACE();
244 268
245 enum DrawCallType { 269 enum DrawCallType {
246 kStrokePath = 0, 270 kStrokePath = 0,
247 kFillPath, 271 kFillPath,
248 kDrawVectorImage, 272 kDrawVectorImage,
249 kDrawBitmapImage, 273 kDrawBitmapImage,
250 kFillText, 274 kFillText,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 static bool IsFullCanvasCompositeMode(SkBlendMode); 389 static bool IsFullCanvasCompositeMode(SkBlendMode);
366 390
367 template <typename DrawFunc> 391 template <typename DrawFunc>
368 void CompositedDraw(const DrawFunc&, 392 void CompositedDraw(const DrawFunc&,
369 PaintCanvas*, 393 PaintCanvas*,
370 CanvasRenderingContext2DState::PaintType, 394 CanvasRenderingContext2DState::PaintType,
371 CanvasRenderingContext2DState::ImageType); 395 CanvasRenderingContext2DState::ImageType);
372 396
373 void ClearCanvas(); 397 void ClearCanvas();
374 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const; 398 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const;
399
400 ImageDataColorSettings GetColorSettingsAsImageDataColorSettings() const;
401
402 bool color_management_enabled_;
375 }; 403 };
376 404
377 template <typename DrawFunc, typename ContainsFunc> 405 template <typename DrawFunc, typename ContainsFunc>
378 bool BaseRenderingContext2D::Draw( 406 bool BaseRenderingContext2D::Draw(
379 const DrawFunc& draw_func, 407 const DrawFunc& draw_func,
380 const ContainsFunc& draw_covers_clip_bounds, 408 const ContainsFunc& draw_covers_clip_bounds,
381 const SkRect& bounds, 409 const SkRect& bounds,
382 CanvasRenderingContext2DState::PaintType paint_type, 410 CanvasRenderingContext2DState::PaintType paint_type,
383 CanvasRenderingContext2DState::ImageType image_type) { 411 CanvasRenderingContext2DState::ImageType image_type) {
384 if (!GetState().IsTransformInvertible()) 412 if (!GetState().IsTransformInvertible())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 foreground_flags.setBlendMode(SkBlendMode::kSrcOver); 492 foreground_flags.setBlendMode(SkBlendMode::kSrcOver);
465 c->setMatrix(ctm); 493 c->setMatrix(ctm);
466 draw_func(c, &foreground_flags); 494 draw_func(c, &foreground_flags);
467 c->restore(); 495 c->restore();
468 c->setMatrix(ctm); 496 c->setMatrix(ctm);
469 } 497 }
470 498
471 } // namespace blink 499 } // namespace blink
472 500
473 #endif // BaseRenderingContext2D_h 501 #endif // BaseRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698