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

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

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 8 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 27 matching lines...) Expand all
38 #include "platform/graphics/paint/PaintRecord.h" 38 #include "platform/graphics/paint/PaintRecord.h"
39 #include "platform/graphics/paint/PaintRecorder.h" 39 #include "platform/graphics/paint/PaintRecorder.h"
40 #include "platform/graphics/skia/SkiaUtils.h" 40 #include "platform/graphics/skia/SkiaUtils.h"
41 #include "third_party/skia/include/core/SkClipOp.h" 41 #include "third_party/skia/include/core/SkClipOp.h"
42 #include "third_party/skia/include/core/SkImageFilter.h" 42 #include "third_party/skia/include/core/SkImageFilter.h"
43 #include "third_party/skia/include/core/SkMetaData.h" 43 #include "third_party/skia/include/core/SkMetaData.h"
44 #include "third_party/skia/include/core/SkRefCnt.h" 44 #include "third_party/skia/include/core/SkRefCnt.h"
45 #include "wtf/Allocator.h" 45 #include "wtf/Allocator.h"
46 #include "wtf/Forward.h" 46 #include "wtf/Forward.h"
47 #include "wtf/Noncopyable.h" 47 #include "wtf/Noncopyable.h"
48 #include <memory>
49 48
50 class SkPath; 49 class SkPath;
51 class SkRRect; 50 class SkRRect;
52 struct SkRect; 51 struct SkRect;
53 52
54 namespace blink { 53 namespace blink {
55 54
56 class FloatRect; 55 class FloatRect;
57 class FloatRoundedRect; 56 class FloatRoundedRect;
58 class KURL; 57 class KURL;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // and fonts are rendered. 145 // and fonts are rendered.
147 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; } 146 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; }
148 float deviceScaleFactor() const { return m_deviceScaleFactor; } 147 float deviceScaleFactor() const { return m_deviceScaleFactor; }
149 148
150 // Returns if the context is a printing context instead of a display 149 // Returns if the context is a printing context instead of a display
151 // context. Bitmap shouldn't be resampled when printing to keep the best 150 // context. Bitmap shouldn't be resampled when printing to keep the best
152 // possible quality. 151 // possible quality.
153 bool printing() const { return m_printing; } 152 bool printing() const { return m_printing; }
154 void setPrinting(bool printing) { m_printing = printing; } 153 void setPrinting(bool printing) { m_printing = printing; }
155 154
155 int printPageNumber() { return m_printPageNumber; }
156 void setPrintPageNumber(int num) { m_printPageNumber = num; }
157
156 SkColorFilter* getColorFilter() const; 158 SkColorFilter* getColorFilter() const;
157 void setColorFilter(ColorFilter); 159 void setColorFilter(ColorFilter);
158 // ---------- End state management methods ----------------- 160 // ---------- End state management methods -----------------
159 161
160 // These draw methods will do both stroking and filling. 162 // These draw methods will do both stroking and filling.
161 // FIXME: ...except drawRect(), which fills properly but always strokes 163 // FIXME: ...except drawRect(), which fills properly but always strokes
162 // using a 1-pixel stroke inset from the rect borders (of the correct 164 // using a 1-pixel stroke inset from the rect borders (of the correct
163 // stroke color). 165 // stroke color).
164 void drawRect(const IntRect&); 166 void drawRect(const IntRect&);
165 void drawLine(const IntPoint&, const IntPoint&); 167 void drawLine(const IntPoint&, const IntPoint&);
166 168
167 void fillPath(const Path&); 169 void fillPath(const Path&);
168 void strokePath(const Path&); 170 void strokePath(const Path&);
169 171
170 void fillEllipse(const FloatRect&); 172 void fillEllipse(const FloatRect&);
171 void strokeEllipse(const FloatRect&); 173 void strokeEllipse(const FloatRect&);
172 174
173 void fillRect(const FloatRect&); 175 void fillRect(const FloatRect&);
174 void fillRect(const FloatRect&, 176 void fillRect(const FloatRect&,
175 const Color&, 177 const Color&,
176 SkBlendMode = SkBlendMode::kSrcOver); 178 SkBlendMode = SkBlendMode::kSrcOver);
177 void fillRoundedRect(const FloatRoundedRect&, const Color&); 179 void fillRoundedRect(const FloatRoundedRect&, const Color&);
178 void fillDRRect(const FloatRoundedRect&, 180 void fillDRRect(const FloatRoundedRect&,
179 const FloatRoundedRect&, 181 const FloatRoundedRect&,
180 const Color&); 182 const Color&);
181 183
182 void strokeRect(const FloatRect&, float lineWidth); 184 void strokeRect(const FloatRect&, float lineWidth);
183 185
184 void drawRecord(const PaintRecord*); 186 void drawRecord(const PaintRecord*);
187 void drawDrawable(const SkDrawable*);
185 void compositeRecord(sk_sp<PaintRecord>, 188 void compositeRecord(sk_sp<PaintRecord>,
186 const FloatRect& dest, 189 const FloatRect& dest,
187 const FloatRect& src, 190 const FloatRect& src,
188 SkBlendMode); 191 SkBlendMode);
189 192
190 void drawImage(Image*, 193 void drawImage(Image*,
191 const FloatRect& destRect, 194 const FloatRect& destRect,
192 const FloatRect* srcRect = nullptr, 195 const FloatRect* srcRect = nullptr,
193 SkBlendMode = SkBlendMode::kSrcOver, 196 SkBlendMode = SkBlendMode::kSrcOver,
194 RespectImageOrientationEnum = DoNotRespectImageOrientation); 197 RespectImageOrientationEnum = DoNotRespectImageOrientation);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Instead of being dispatched to the active canvas, draw commands following 288 // Instead of being dispatched to the active canvas, draw commands following
286 // beginRecording() are stored in a display list that can be replayed at a 289 // beginRecording() are stored in a display list that can be replayed at a
287 // later time. Pass in the bounding rectangle for the content in the list. 290 // later time. Pass in the bounding rectangle for the content in the list.
288 void beginRecording(const FloatRect&); 291 void beginRecording(const FloatRect&);
289 292
290 // Returns a record with any recorded draw commands since the prerequisite 293 // Returns a record with any recorded draw commands since the prerequisite
291 // call to beginRecording(). The record is guaranteed to be non-null (but 294 // call to beginRecording(). The record is guaranteed to be non-null (but
292 // not necessarily non-empty), even when the context is disabled. 295 // not necessarily non-empty), even when the context is disabled.
293 sk_sp<PaintRecord> endRecording(); 296 sk_sp<PaintRecord> endRecording();
294 297
298 sk_sp<SkDrawable> endRecordingAsDrawable();
299
295 void setShadow(const FloatSize& offset, 300 void setShadow(const FloatSize& offset,
296 float blur, 301 float blur,
297 const Color&, 302 const Color&,
298 DrawLooperBuilder::ShadowTransformMode = 303 DrawLooperBuilder::ShadowTransformMode =
299 DrawLooperBuilder::ShadowRespectsTransforms, 304 DrawLooperBuilder::ShadowRespectsTransforms,
300 DrawLooperBuilder::ShadowAlphaMode = 305 DrawLooperBuilder::ShadowAlphaMode =
301 DrawLooperBuilder::ShadowRespectsAlpha, 306 DrawLooperBuilder::ShadowRespectsAlpha,
302 ShadowMode = DrawShadowAndForeground); 307 ShadowMode = DrawShadowAndForeground);
303 308
304 void setDrawLooper(sk_sp<SkDrawLooper>); 309 void setDrawLooper(sk_sp<SkDrawLooper>);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 #if DCHECK_IS_ON() 446 #if DCHECK_IS_ON()
442 int m_layerCount; 447 int m_layerCount;
443 bool m_disableDestructionChecks; 448 bool m_disableDestructionChecks;
444 bool m_inDrawingRecorder; 449 bool m_inDrawingRecorder;
445 #endif 450 #endif
446 451
447 const DisabledMode m_disabledState; 452 const DisabledMode m_disabledState;
448 453
449 float m_deviceScaleFactor; 454 float m_deviceScaleFactor;
450 455
456 int m_printPageNumber;
457
451 unsigned m_printing : 1; 458 unsigned m_printing : 1;
452 unsigned m_hasMetaData : 1; 459 unsigned m_hasMetaData : 1;
453 }; 460 };
454 461
455 } // namespace blink 462 } // namespace blink
456 463
457 #endif // GraphicsContext_h 464 #endif // GraphicsContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698