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

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

Issue 14550002: Making GraphicsContext the owner of PlatformContext. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing tests and addressing comments. Created 7 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 | Annotate | Revision Log
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "third_party/skia/include/core/SkPath.h" 43 #include "third_party/skia/include/core/SkPath.h"
44 #include "third_party/skia/include/core/SkRect.h" 44 #include "third_party/skia/include/core/SkRect.h"
45 #include "third_party/skia/include/core/SkRRect.h" 45 #include "third_party/skia/include/core/SkRRect.h"
46 #include "third_party/skia/include/effects/SkCornerPathEffect.h" 46 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
47 47
48 #include <wtf/Noncopyable.h> 48 #include <wtf/Noncopyable.h>
49 #include <wtf/PassOwnPtr.h> 49 #include <wtf/PassOwnPtr.h>
50 50
51 namespace WebCore { 51 namespace WebCore {
52 class PlatformContextSkia; 52 class PlatformContextSkia;
53 typedef PlatformContextSkia GraphicsContextPlatformPrivate;
54 } 53 }
55 typedef WebCore::PlatformContextSkia PlatformGraphicsContext; 54 typedef WebCore::PlatformContextSkia PlatformGraphicsContext;
56 55
57 namespace WebCore { 56 namespace WebCore {
58 57
59 const int cMisspellingLineThickness = 3; 58 const int cMisspellingLineThickness = 3;
60 const int cMisspellingLinePatternWidth = 4; 59 const int cMisspellingLinePatternWidth = 4;
61 const int cMisspellingLinePatternGapWidth = 1; 60 const int cMisspellingLinePatternGapWidth = 1;
62 61
63 class AffineTransform; 62 class AffineTransform;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 bool shouldAntialias : 1; 147 bool shouldAntialias : 1;
149 bool shouldSmoothFonts : 1; 148 bool shouldSmoothFonts : 1;
150 bool shouldSubpixelQuantizeFonts : 1; 149 bool shouldSubpixelQuantizeFonts : 1;
151 bool paintingDisabled : 1; 150 bool paintingDisabled : 1;
152 bool shadowsIgnoreTransforms : 1; 151 bool shadowsIgnoreTransforms : 1;
153 }; 152 };
154 153
155 class GraphicsContext { 154 class GraphicsContext {
156 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; 155 WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
157 public: 156 public:
158 GraphicsContext(PlatformGraphicsContext*); 157 explicit GraphicsContext(SkCanvas*);
159 ~GraphicsContext(); 158 ~GraphicsContext();
160 159
161 PlatformGraphicsContext* platformContext() const; 160 PlatformGraphicsContext* platformContext() const;
162 161
163 float strokeThickness() const; 162 float strokeThickness() const;
164 void setStrokeThickness(float); 163 void setStrokeThickness(float);
165 StrokeStyle strokeStyle() const; 164 StrokeStyle strokeStyle() const;
166 void setStrokeStyle(StrokeStyle); 165 void setStrokeStyle(StrokeStyle);
167 Color strokeColor() const; 166 Color strokeColor() const;
168 ColorSpace strokeColorSpace() const; 167 ColorSpace strokeColorSpace() const;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 value = -value; 380 value = -value;
382 isNeg = true; 381 isNeg = true;
383 } 382 }
384 if (value >= max) 383 if (value >= max)
385 value %= max; 384 value %= max;
386 if (isNeg) 385 if (isNeg)
387 value = -value; 386 value = -value;
388 return value; 387 return value;
389 } 388 }
390 389
391 GraphicsContextPlatformPrivate* m_data; 390 OwnPtr<PlatformContextSkia> m_data;
392 391
393 GraphicsContextState m_state; 392 GraphicsContextState m_state;
394 Vector<GraphicsContextState> m_stack; 393 Vector<GraphicsContextState> m_stack;
395 bool m_updatingControlTints; 394 bool m_updatingControlTints;
396 unsigned m_transparencyCount; 395 unsigned m_transparencyCount;
397 }; 396 };
398 397
399 class GraphicsContextStateSaver { 398 class GraphicsContextStateSaver {
400 WTF_MAKE_FAST_ALLOCATED; 399 WTF_MAKE_FAST_ALLOCATED;
401 public: 400 public:
(...skipping 29 matching lines...) Expand all
431 430
432 private: 431 private:
433 GraphicsContext& m_context; 432 GraphicsContext& m_context;
434 bool m_saveAndRestore; 433 bool m_saveAndRestore;
435 }; 434 };
436 435
437 } // namespace WebCore 436 } // namespace WebCore
438 437
439 #endif // GraphicsContext_h 438 #endif // GraphicsContext_h
440 439
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698