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

Side by Side Diff: Source/platform/graphics/GraphicsContext.h

Issue 868743002: Use SkXfermode::Mode in code related to Image. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to ToT Created 5 years, 11 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 /* 1 /*
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 3 * Copyright (C) 2008-2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return alpha > 255 ? 255 : alpha; 179 return alpha > 255 ? 255 : alpha;
180 } 180 }
181 181
182 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta te()->setInterpolationQuality(quality); } 182 void setImageInterpolationQuality(InterpolationQuality quality) { mutableSta te()->setInterpolationQuality(quality); }
183 InterpolationQuality imageInterpolationQuality() const { return immutableSta te()->interpolationQuality(); } 183 InterpolationQuality imageInterpolationQuality() const { return immutableSta te()->interpolationQuality(); }
184 184
185 void setCompositeOperation(SkXfermode::Mode); 185 void setCompositeOperation(SkXfermode::Mode);
186 SkXfermode::Mode compositeOperation() const; 186 SkXfermode::Mode compositeOperation() const;
187 // TODO(dshwang): remove these method. crbug.com/425656 187 // TODO(dshwang): remove these method. crbug.com/425656
188 CompositeOperator compositeOperationDeprecated() const; 188 CompositeOperator compositeOperationDeprecated() const;
189 WebBlendMode blendModeOperation() const;
190 189
191 // Specify the device scale factor which may change the way document markers 190 // Specify the device scale factor which may change the way document markers
192 // and fonts are rendered. 191 // and fonts are rendered.
193 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } 192 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; }
194 float deviceScaleFactor() const { return m_deviceScaleFactor; } 193 float deviceScaleFactor() const { return m_deviceScaleFactor; }
195 194
196 // If true we are (most likely) rendering to a web page and the 195 // If true we are (most likely) rendering to a web page and the
197 // canvas has been prepared with an opaque background. If false, 196 // canvas has been prepared with an opaque background. If false,
198 // the canvas may have transparency (as is the case when rendering 197 // the canvas may have transparency (as is the case when rendering
199 // to a canvas object). 198 // to a canvas object).
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void strokeRect(const FloatRect&); 256 void strokeRect(const FloatRect&);
258 void strokeRect(const FloatRect&, float lineWidth); 257 void strokeRect(const FloatRect&, float lineWidth);
259 258
260 void fillBetweenRoundedRects(const FloatRect&, const FloatSize& outerTopLeft , const FloatSize& outerTopRight, const FloatSize& outerBottomLeft, const FloatS ize& outerBottomRight, 259 void fillBetweenRoundedRects(const FloatRect&, const FloatSize& outerTopLeft , const FloatSize& outerTopRight, const FloatSize& outerBottomLeft, const FloatS ize& outerBottomRight,
261 const FloatRect&, const FloatSize& innerTopLeft, const FloatSize& innerT opRight, const FloatSize& innerBottomLeft, const FloatSize& innerBottomRight, co nst Color&); 260 const FloatRect&, const FloatSize& innerTopLeft, const FloatSize& innerT opRight, const FloatSize& innerBottomLeft, const FloatSize& innerBottomRight, co nst Color&);
262 void fillBetweenRoundedRects(const FloatRoundedRect&, const FloatRoundedRect &, const Color&); 261 void fillBetweenRoundedRects(const FloatRoundedRect&, const FloatRoundedRect &, const Color&);
263 262
264 void drawPicture(const SkPicture*); 263 void drawPicture(const SkPicture*);
265 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr c, CompositeOperator, WebBlendMode); 264 void compositePicture(SkPicture*, const FloatRect& dest, const FloatRect& sr c, CompositeOperator, WebBlendMode);
266 265
267 void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceO ver, RespectImageOrientationEnum = DoNotRespectImageOrientation); 266 void drawImage(Image*, const IntPoint&, SkXfermode::Mode = SkXfermode::kSrcO ver_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation);
268 void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOv er, RespectImageOrientationEnum = DoNotRespectImageOrientation); 267 void drawImage(Image*, const IntRect&, SkXfermode::Mode = SkXfermode::kSrcOv er_Mode, RespectImageOrientationEnum = DoNotRespectImageOrientation);
269 void drawImage(Image*, const FloatRect& destRect); 268 void drawImage(Image*, const FloatRect& destRect);
270 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotResp ectImageOrientation); 269 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, SkXfermode::Mode = SkXfermode::kSrcOver_Mode, RespectImageOrientationEnum = DoNo tRespectImageOrientation);
271 void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, WebBlendMode, RespectImageOrientationEnum = DoNotRespectImage Orientation);
272 270
273 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin t, const IntSize& tileSize, 271 void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoin t, const IntSize& tileSize,
274 CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlendModeNorm al, const IntSize& repeatSpacing = IntSize()); 272 SkXfermode::Mode = SkXfermode::kSrcOver_Mode, const IntSize& repeatSpaci ng = IntSize());
275 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, 273 void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
276 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch Tile, Image::TileRule vRule = Image::StretchTile, 274 const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::Stretch Tile, Image::TileRule vRule = Image::StretchTile,
277 CompositeOperator = CompositeSourceOver); 275 SkXfermode::Mode = SkXfermode::kSrcOver_Mode);
278 276
279 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec t* srcRect = 0, CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlend ModeNormal); 277 void drawImageBuffer(ImageBuffer*, const FloatRect& destRect, const FloatRec t* srcRect = 0, CompositeOperator = CompositeSourceOver, WebBlendMode = WebBlend ModeNormal);
280 278
281 // These methods write to the canvas. 279 // These methods write to the canvas.
282 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou ndedRect 280 // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRou ndedRect
283 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); 281 void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y);
284 void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0); 282 void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0);
285 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP aint* = 0); 283 void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkP aint* = 0);
286 void drawImage(const SkImage*, SkScalar, SkScalar, const SkPaint* = 0); 284 void drawImage(const SkImage*, SkScalar, SkScalar, const SkPaint* = 0);
287 void drawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPai nt* = 0); 285 void drawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPai nt* = 0);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 376
379 void beginAnnotation(const AnnotationList&); 377 void beginAnnotation(const AnnotationList&);
380 void endAnnotation(); 378 void endAnnotation();
381 379
382 // This method can potentially push saves onto the canvas. It returns the in itial save count, 380 // This method can potentially push saves onto the canvas. It returns the in itial save count,
383 // and should be balanced with a call to context->canvas()->restoreToCount(i nitialSaveCount). 381 // and should be balanced with a call to context->canvas()->restoreToCount(i nitialSaveCount).
384 WARN_UNUSED_RETURN int preparePaintForDrawRectToRect( 382 WARN_UNUSED_RETURN int preparePaintForDrawRectToRect(
385 SkPaint*, 383 SkPaint*,
386 const SkRect& srcRect, 384 const SkRect& srcRect,
387 const SkRect& destRect, 385 const SkRect& destRect,
388 CompositeOperator, 386 SkXfermode::Mode,
389 WebBlendMode,
390 bool isBitmapWithAlpha, 387 bool isBitmapWithAlpha,
391 bool isLazyDecoded = false, 388 bool isLazyDecoded = false,
392 bool isDataComplete = true) const; 389 bool isDataComplete = true) const;
393 390
394 static int focusRingOutsetExtent(int offset, int width) 391 static int focusRingOutsetExtent(int offset, int width)
395 { 392 {
396 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2; 393 return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2;
397 } 394 }
398 395
399 // public decl needed for OwnPtr wrapper. 396 // public decl needed for OwnPtr wrapper.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 unsigned m_accelerated : 1; 513 unsigned m_accelerated : 1;
517 unsigned m_isCertainlyOpaque : 1; 514 unsigned m_isCertainlyOpaque : 1;
518 unsigned m_printing : 1; 515 unsigned m_printing : 1;
519 unsigned m_antialiasHairlineImages : 1; 516 unsigned m_antialiasHairlineImages : 1;
520 unsigned m_shouldSmoothFonts : 1; 517 unsigned m_shouldSmoothFonts : 1;
521 }; 518 };
522 519
523 } // namespace blink 520 } // namespace blink
524 521
525 #endif // GraphicsContext_h 522 #endif // GraphicsContext_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/GradientGeneratedImage.cpp ('k') | Source/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698