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

Side by Side Diff: include/private/SkMiniRecorder.h

Issue 2183193002: don't specialize drawBitmapRect for minirecorder; no longer called by blink (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | src/core/SkMiniRecorder.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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMiniRecorder_DEFINED 8 #ifndef SkMiniRecorder_DEFINED
9 #define SkMiniRecorder_DEFINED 9 #define SkMiniRecorder_DEFINED
10 10
11 #include "SkRecords.h" 11 #include "SkRecords.h"
12 #include "SkScalar.h" 12 #include "SkScalar.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 class SkCanvas; 14 class SkCanvas;
15 15
16 // Records small pictures, but only a limited subset of the canvas API, and may fail. 16 // Records small pictures, but only a limited subset of the canvas API, and may fail.
17 class SkMiniRecorder : SkNoncopyable { 17 class SkMiniRecorder : SkNoncopyable {
18 public: 18 public:
19 SkMiniRecorder(); 19 SkMiniRecorder();
20 ~SkMiniRecorder(); 20 ~SkMiniRecorder();
21 21
22 // Try to record an op. Returns false on failure. 22 // Try to record an op. Returns false on failure.
23 bool drawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
24 const SkPaint*, SkCanvas::SrcRectConstraint);
25 bool drawPath(const SkPath&, const SkPaint&); 23 bool drawPath(const SkPath&, const SkPaint&);
26 bool drawRect(const SkRect&, const SkPaint&); 24 bool drawRect(const SkRect&, const SkPaint&);
27 bool drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint&) ; 25 bool drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint&) ;
28 26
29 // Detach anything we've recorded as a picture, resetting this SkMiniRecorde r. 27 // Detach anything we've recorded as a picture, resetting this SkMiniRecorde r.
30 sk_sp<SkPicture> detachAsPicture(const SkRect& cull); 28 sk_sp<SkPicture> detachAsPicture(const SkRect& cull);
31 29
32 // Flush anything we've recorded to the canvas, resetting this SkMiniRecorde r. 30 // Flush anything we've recorded to the canvas, resetting this SkMiniRecorde r.
33 // This is logically the same as but rather more efficient than: 31 // This is logically the same as but rather more efficient than:
34 // SkAutoTUnref<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()) ); 32 // SkAutoTUnref<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()) );
35 // pic->playback(canvas); 33 // pic->playback(canvas);
36 void flushAndReset(SkCanvas*); 34 void flushAndReset(SkCanvas*);
37 35
38 private: 36 private:
39 enum class State { 37 enum class State {
40 kEmpty, 38 kEmpty,
41 kDrawBitmapRectFixedSize,
42 kDrawPath, 39 kDrawPath,
43 kDrawRect, 40 kDrawRect,
44 kDrawTextBlob, 41 kDrawTextBlob,
45 }; 42 };
46 43
47 State fState; 44 State fState;
48 45
49 template <size_t A, size_t B> 46 template <size_t A, size_t B>
50 struct Max { static const size_t val = A > B ? A : B; }; 47 struct Max { static const size_t val = A > B ? A : B; };
51 48
52 static const size_t kInlineStorage = 49 static const size_t kInlineStorage =
53 Max<sizeof(SkRecords::DrawBitmapRectFixedSize),
54 Max<sizeof(SkRecords::DrawPath), 50 Max<sizeof(SkRecords::DrawPath),
55 Max<sizeof(SkRecords::DrawRect), 51 Max<sizeof(SkRecords::DrawRect),
56 sizeof(SkRecords::DrawTextBlob)>::val>::val>::val; 52 sizeof(SkRecords::DrawTextBlob)>::val>::val;
57 SkAlignedSStorage<kInlineStorage> fBuffer; 53 SkAlignedSStorage<kInlineStorage> fBuffer;
58 }; 54 };
59 55
60 #endif//SkMiniRecorder_DEFINED 56 #endif//SkMiniRecorder_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkMiniRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698