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

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

Issue 17448009: Use skia::RefPtr to avoid having to manually refcount GraphicsContextState::m_looper. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: switch to skia::RefPtr, remove superfluous copy of m_imageBufferClip Created 7 years, 6 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
« no previous file with comments | « no previous file | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
31 #include "core/platform/chromium/TraceEvent.h" 31 #include "core/platform/chromium/TraceEvent.h"
32 #include "core/platform/graphics/DashArray.h" 32 #include "core/platform/graphics/DashArray.h"
33 #include "core/platform/graphics/DrawLooper.h" 33 #include "core/platform/graphics/DrawLooper.h"
34 #include "core/platform/graphics/FloatRect.h" 34 #include "core/platform/graphics/FloatRect.h"
35 #include "core/platform/graphics/Font.h" 35 #include "core/platform/graphics/Font.h"
36 #include "core/platform/graphics/GraphicsContextAnnotation.h" 36 #include "core/platform/graphics/GraphicsContextAnnotation.h"
37 #include "core/platform/graphics/GraphicsContextState.h" 37 #include "core/platform/graphics/GraphicsContextState.h"
38 #include "core/platform/graphics/ImageBuffer.h" 38 #include "core/platform/graphics/ImageBuffer.h"
39 #include "core/platform/graphics/ImageOrientation.h" 39 #include "core/platform/graphics/ImageOrientation.h"
40 #include "core/platform/graphics/skia/OpaqueRegionSkia.h" 40 #include "core/platform/graphics/skia/OpaqueRegionSkia.h"
41 41 #include "skia/ext/refptr.h"
jamesr 2013/06/19 17:45:26 this creates a cycle between the chromium and blin
42 #include "third_party/skia/include/core/SkBitmap.h" 42 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "third_party/skia/include/core/SkDevice.h" 43 #include "third_party/skia/include/core/SkDevice.h"
44 #include "third_party/skia/include/core/SkPaint.h" 44 #include "third_party/skia/include/core/SkPaint.h"
45 #include "third_party/skia/include/core/SkPath.h" 45 #include "third_party/skia/include/core/SkPath.h"
46 #include "third_party/skia/include/core/SkRect.h" 46 #include "third_party/skia/include/core/SkRect.h"
47 #include "third_party/skia/include/core/SkRRect.h" 47 #include "third_party/skia/include/core/SkRRect.h"
48 #include "third_party/skia/include/effects/SkCornerPathEffect.h" 48 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
49 49 #include "wtf/Noncopyable.h"
50 #include <wtf/Noncopyable.h> 50 #include "wtf/PassOwnPtr.h"
51 #include <wtf/PassOwnPtr.h>
52 51
53 namespace WebCore { 52 namespace WebCore {
54 53
55 class ImageBuffer; 54 class ImageBuffer;
56 class KURL; 55 class KURL;
57 56
58 class GraphicsContext { 57 class GraphicsContext {
59 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; 58 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
60 public: 59 public:
61 enum AntiAliasingMode { 60 enum AntiAliasingMode {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 Color fillColor() const { return m_state->m_fillColor; } 128 Color fillColor() const { return m_state->m_fillColor; }
130 void setFillColor(const Color&); 129 void setFillColor(const Color&);
131 SkColor effectiveFillColor() const { return m_state->applyAlpha(m_state->m_f illColor.rgb()); } 130 SkColor effectiveFillColor() const { return m_state->applyAlpha(m_state->m_f illColor.rgb()); }
132 131
133 void setFillPattern(PassRefPtr<Pattern>); 132 void setFillPattern(PassRefPtr<Pattern>);
134 Pattern* fillPattern() const { return m_state->m_fillPattern.get(); } 133 Pattern* fillPattern() const { return m_state->m_fillPattern.get(); }
135 134
136 void setFillGradient(PassRefPtr<Gradient>); 135 void setFillGradient(PassRefPtr<Gradient>);
137 Gradient* fillGradient() const { return m_state->m_fillGradient.get(); } 136 Gradient* fillGradient() const { return m_state->m_fillGradient.get(); }
138 137
139 SkDrawLooper* drawLooper() const { return m_state->m_looper; } 138 SkDrawLooper* drawLooper() const { return m_state->m_looper.get(); }
140 SkColor effectiveStrokeColor() const { return m_state->applyAlpha(m_state->m _strokeData.color().rgb()); } 139 SkColor effectiveStrokeColor() const { return m_state->applyAlpha(m_state->m _strokeData.color().rgb()); }
141 140
142 int getNormalizedAlpha() const; 141 int getNormalizedAlpha() const;
143 142
144 bool getClipBounds(SkRect* bounds) const; 143 bool getClipBounds(SkRect* bounds) const;
145 const SkMatrix& getTotalMatrix() const; 144 const SkMatrix& getTotalMatrix() const;
146 bool isPrintingDevice() const; 145 bool isPrintingDevice() const;
147 146
148 void setShadowsIgnoreTransforms(bool ignoreTransforms) { m_state->m_shadowsI gnoreTransforms = ignoreTransforms; } 147 void setShadowsIgnoreTransforms(bool ignoreTransforms) { m_state->m_shadowsI gnoreTransforms = ignoreTransforms; }
149 bool shadowsIgnoreTransforms() const { return m_state->m_shadowsIgnoreTransf orms; } 148 bool shadowsIgnoreTransforms() const { return m_state->m_shadowsIgnoreTransf orms; }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 value = -value; 386 value = -value;
388 isNeg = true; 387 isNeg = true;
389 } 388 }
390 if (value >= max) 389 if (value >= max)
391 value %= max; 390 value %= max;
392 if (isNeg) 391 if (isNeg)
393 value = -value; 392 value = -value;
394 return value; 393 return value;
395 } 394 }
396 395
397 void setDrawLooper(SkDrawLooper* looper) { SkRefCnt_SafeAssign(m_state->m_lo oper, looper); } 396 void setDrawLooper(SkDrawLooper* looper) { m_state->m_looper = skia::SharePt r(looper); }
398 397
399 // Sets up the common flags on a paint for antialiasing, effects, etc. 398 // Sets up the common flags on a paint for antialiasing, effects, etc.
400 // This is implicitly called by setupPaintFill and setupPaintStroke, but 399 // This is implicitly called by setupPaintFill and setupPaintStroke, but
401 // you may wish to call it directly sometimes if you don't want that other 400 // you may wish to call it directly sometimes if you don't want that other
402 // behavior. 401 // behavior.
403 void setupPaintCommon(SkPaint*) const; 402 void setupPaintCommon(SkPaint*) const;
404 403
405 // Helpers for drawing a focus ring (drawFocusRing) 404 // Helpers for drawing a focus ring (drawFocusRing)
406 void drawOuterPath(const SkPath&, SkPaint&, int); 405 void drawOuterPath(const SkPath&, SkPaint&, int);
407 void drawInnerPath(const SkPath&, SkPaint&, int); 406 void drawInnerPath(const SkPath&, SkPaint&, int);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // FIXME: Make this go away: crbug.com/236892 468 // FIXME: Make this go away: crbug.com/236892
470 bool m_updatingControlTints : 1; 469 bool m_updatingControlTints : 1;
471 bool m_accelerated : 1; 470 bool m_accelerated : 1;
472 bool m_isCertainlyOpaque : 1; 471 bool m_isCertainlyOpaque : 1;
473 bool m_printing : 1; 472 bool m_printing : 1;
474 }; 473 };
475 474
476 } // namespace WebCore 475 } // namespace WebCore
477 476
478 #endif // GraphicsContext_h 477 #endif // GraphicsContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698