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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix for mac build Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 29 matching lines...) Expand all
40 #include "platform/graphics/Path.h" 40 #include "platform/graphics/Path.h"
41 #include "platform/transforms/AffineTransform.h" 41 #include "platform/transforms/AffineTransform.h"
42 #include "wtf/HashMap.h" 42 #include "wtf/HashMap.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 #include "wtf/text/WTFString.h" 44 #include "wtf/text/WTFString.h"
45 45
46 namespace blink { class WebLayer; } 46 namespace blink { class WebLayer; }
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class CanvasImageSource;
50 class CanvasGradient; 51 class CanvasGradient;
51 class CanvasPattern; 52 class CanvasPattern;
52 class CanvasStyle; 53 class CanvasStyle;
53 class DOMPath; 54 class DOMPath;
54 class Element; 55 class Element;
55 class ExceptionState; 56 class ExceptionState;
56 class FloatRect; 57 class FloatRect;
57 class GraphicsContext; 58 class GraphicsContext;
58 class HTMLCanvasElement; 59 class HTMLCanvasElement;
59 class HTMLImageElement; 60 class HTMLImageElement;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void setShadow(float width, float height, float blur); 171 void setShadow(float width, float height, float blur);
171 void setShadow(float width, float height, float blur, const String& color); 172 void setShadow(float width, float height, float blur, const String& color);
172 void setShadow(float width, float height, float blur, float grayLevel); 173 void setShadow(float width, float height, float blur, float grayLevel);
173 void setShadow(float width, float height, float blur, const String& color, f loat alpha); 174 void setShadow(float width, float height, float blur, const String& color, f loat alpha);
174 void setShadow(float width, float height, float blur, float grayLevel, float alpha); 175 void setShadow(float width, float height, float blur, float grayLevel, float alpha);
175 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a); 176 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a);
176 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a); 177 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a);
177 178
178 void clearShadow(); 179 void clearShadow();
179 180
180 void drawImage(ImageBitmap*, float x, float y, ExceptionState&); 181 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&);
181 void drawImage(ImageBitmap*, float x, float y, float width, float height, Ex ceptionState&); 182 void drawImage(CanvasImageSource*, float x, float y, float width, float heig ht, ExceptionState&);
182 void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float d x, float dy, float dw, float dh, ExceptionState&); 183 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
183 void drawImage(HTMLImageElement*, float x, float y, ExceptionState&); 184 void drawImage(CanvasImageSource*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
184 void drawImage(HTMLImageElement*, float x, float y, float width, float heigh t, ExceptionState&);
185 void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
186 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
187 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const blink::WebBlendMode&, ExceptionState&) ;
188 void drawImage(HTMLCanvasElement*, float x, float y, ExceptionState&);
189 void drawImage(HTMLCanvasElement*, float x, float y, float width, float heig ht, ExceptionState&);
190 void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
191 void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
192 void drawImage(HTMLVideoElement*, float x, float y, ExceptionState&);
193 void drawImage(HTMLVideoElement*, float x, float y, float width, float heigh t, ExceptionState&);
194 void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
195 void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
196 185
197 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0, 186 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0,
198 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString()); 187 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
199 188
200 void setAlpha(float); 189 void setAlpha(float);
201 190
202 void setCompositeOperation(const String&); 191 void setCompositeOperation(const String&);
203 192
204 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&); 193 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&);
205 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&); 194 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&);
206 PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& rep etitionType, ExceptionState&); 195 PassRefPtr<CanvasPattern> createPattern(CanvasImageSource*, const String& re petitionType, ExceptionState&);
207 PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& re petitionType, ExceptionState&);
208 196
209 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const; 197 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const;
210 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const; 198 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const;
211 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const; 199 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const;
212 void putImageData(ImageData*, float dx, float dy, ExceptionState&); 200 void putImageData(ImageData*, float dx, float dy, ExceptionState&);
213 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&); 201 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&);
214 202
215 // Slated for deprecation: 203 // Slated for deprecation:
216 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); } 204 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); }
217 void webkitPutImageDataHD(ImageData* image, float dx, float dy, float dirtyX , float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState& e) { putIma geData(image, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, e); } 205 void webkitPutImageDataHD(ImageData* image, float dx, float dy, float dirtyX , float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState& e) { putIma geData(image, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, e); }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); 279 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode);
292 280
293 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); } 281 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); }
294 const State& state() const { return m_stateStack.last(); } 282 const State& state() const { return m_stateStack.last(); }
295 283
296 void applyLineDash() const; 284 void applyLineDash() const;
297 void setShadow(const FloatSize& offset, float blur, RGBA32 color); 285 void setShadow(const FloatSize& offset, float blur, RGBA32 color);
298 void applyShadow(); 286 void applyShadow();
299 bool shouldDrawShadows() const; 287 bool shouldDrawShadows() const;
300 288
301 void drawImageInternal(Image*, const FloatRect&, const FloatRect&, const Com positeOperator&, const blink::WebBlendMode&);
302 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); 289 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
303 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); 290 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*);
304 void didDraw(const FloatRect&); 291 void didDraw(const FloatRect&);
305 292
306 GraphicsContext* drawingContext() const; 293 GraphicsContext* drawingContext() const;
307 294
308 void unwindStateStack(); 295 void unwindStateStack();
309 void realizeSaves(); 296 void realizeSaves();
310 297
311 void applyStrokePattern(); 298 void applyStrokePattern();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 bool m_usesCSSCompatibilityParseMode; 333 bool m_usesCSSCompatibilityParseMode;
347 bool m_hasAlpha; 334 bool m_hasAlpha;
348 MutableStylePropertyMap m_fetchedFonts; 335 MutableStylePropertyMap m_fetchedFonts;
349 }; 336 };
350 337
351 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 338 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
352 339
353 } // namespace WebCore 340 } // namespace WebCore
354 341
355 #endif 342 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698