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

Side by Side Diff: third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.h

Issue 2705723002: Convert SkiaBitLocker to use PaintCanvas (Closed)
Patch Set: Remove rogue cc:: Created 3 years, 10 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GraphicsContextCanvas_h
6 #define GraphicsContextCanvas_h
7
8 #include <ApplicationServices/ApplicationServices.h>
9
10 #include "platform/PlatformExport.h"
11 #include "platform/graphics/paint/PaintCanvas.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
13
14 struct SkIRect;
15
16 namespace blink {
17
18 // Converts a PaintCanvas temporarily to a CGContext
19 class PLATFORM_EXPORT GraphicsContextCanvas {
20 public:
21 /**
22 User clip rect is an *additional* clip to be applied in addition to the
23 current state of the canvas, in *local* rather than device coordinates.
24 If no additional clipping is desired, pass in
25 SkIRect::MakeSize(canvas->getBaseLayerSize()) transformed by the inverse
26 CTM.
27 */
28 GraphicsContextCanvas(PaintCanvas*,
29 const SkIRect& userClipRect,
30 SkScalar bitmapScaleFactor = 1);
31 ~GraphicsContextCanvas();
32 CGContextRef cgContext();
33 bool hasEmptyClipRegion() const;
34
35 private:
36 void releaseIfNeeded();
37 SkIRect computeDirtyRect();
38
39 PaintCanvas* m_canvas;
40
41 CGContextRef m_cgContext;
42 // m_offscreen is only valid if m_useDeviceBits is false
43 SkBitmap m_offscreen;
44 SkIPoint m_bitmapOffset;
45 SkScalar m_bitmapScaleFactor;
46
47 // True if we are drawing to |m_canvas|'s backing store directly.
48 // Otherwise, the bits in |bitmap_| are our allocation and need to
49 // be copied over to |m_canvas|.
50 bool m_useDeviceBits;
51
52 // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating
53 // a non-null CGContext (it is invalid to use a null CGContext), and will not
54 // be copied to |m_canvas|. This will happen if |m_canvas|'s clip region is
55 // empty.
56 bool m_bitmapIsDummy;
57 };
58
59 } // namespace blink
60
61 #endif // GraphicsContextCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698