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

Side by Side Diff: src/core/SkBlitter.h

Issue 1060153003: add new blit2 methods in support of antialiased hairlines guard flag SK_SUPPORT_LEGACY_BLITANTIH2V2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: specialize non-opaque color as well Created 5 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
« no previous file with comments | « no previous file | src/core/SkBlitter_ARGB32.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
2 /* 1 /*
3 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9
10 #ifndef SkBlitter_DEFINED 8 #ifndef SkBlitter_DEFINED
11 #define SkBlitter_DEFINED 9 #define SkBlitter_DEFINED
12 10
11 #ifdef SK_SUPPORT_LEGACY_BLITANTIH2V2
12 #define SK_BLITANTIH2V2_VIRTUAL
13 #else
14 #define SK_BLITANTIH2V2_VIRTUAL virtual
15 #endif
16
13 #include "SkBitmap.h" 17 #include "SkBitmap.h"
14 #include "SkBitmapProcShader.h" 18 #include "SkBitmapProcShader.h"
15 #include "SkMask.h" 19 #include "SkMask.h"
16 #include "SkMatrix.h" 20 #include "SkMatrix.h"
17 #include "SkPaint.h" 21 #include "SkPaint.h"
18 #include "SkRefCnt.h" 22 #include "SkRefCnt.h"
19 #include "SkRegion.h" 23 #include "SkRegion.h"
20 #include "SkShader.h" 24 #include "SkShader.h"
21 #include "SkSmallAllocator.h" 25 #include "SkSmallAllocator.h"
22 26
(...skipping 25 matching lines...) Expand all
48 /// Blit a pattern of pixels defined by a rectangle-clipped mask; 52 /// Blit a pattern of pixels defined by a rectangle-clipped mask;
49 /// typically used for text. 53 /// typically used for text.
50 virtual void blitMask(const SkMask&, const SkIRect& clip); 54 virtual void blitMask(const SkMask&, const SkIRect& clip);
51 55
52 /** If the blitter just sets a single value for each pixel, return the 56 /** If the blitter just sets a single value for each pixel, return the
53 bitmap it draws into, and assign value. If not, return NULL and ignore 57 bitmap it draws into, and assign value. If not, return NULL and ignore
54 the value parameter. 58 the value parameter.
55 */ 59 */
56 virtual const SkBitmap* justAnOpaqueColor(uint32_t* value); 60 virtual const SkBitmap* justAnOpaqueColor(uint32_t* value);
57 61
62 // (x, y), (x + 1, y)
63 SK_BLITANTIH2V2_VIRTUAL void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
64 int16_t runs[3];
65 uint8_t aa[2];
66
67 runs[0] = 1;
68 runs[1] = 1;
69 runs[2] = 0;
70 aa[0] = SkToU8(a0);
71 aa[1] = SkToU8(a1);
72 this->blitAntiH(x, y, aa, runs);
73 }
74
75 // (x, y), (x, y + 1)
76 SK_BLITANTIH2V2_VIRTUAL void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
77 int16_t runs[2];
78 uint8_t aa[1];
79
80 runs[0] = 1;
81 runs[1] = 0;
82 aa[0] = SkToU8(a0);
83 this->blitAntiH(x, y, aa, runs);
84 // reset in case the clipping blitter modified runs
85 runs[0] = 1;
86 runs[1] = 0;
87 aa[0] = SkToU8(a1);
88 this->blitAntiH(x, y + 1, aa, runs);
89 }
90
58 /** 91 /**
59 * Special method just to identify the null blitter, which is returned 92 * Special method just to identify the null blitter, which is returned
60 * from Choose() if the request cannot be fulfilled. Default impl 93 * from Choose() if the request cannot be fulfilled. Default impl
61 * returns false. 94 * returns false.
62 */ 95 */
63 virtual bool isNullBlitter() const; 96 virtual bool isNullBlitter() const;
64 97
65 /** 98 /**
66 * Special methods for SkShaderBlitter. On all other classes this is a no-o p. 99 * Special methods for SkShaderBlitter. On all other classes this is a no-o p.
67 */ 100 */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, 241 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip,
209 const SkIRect* bounds = NULL); 242 const SkIRect* bounds = NULL);
210 243
211 private: 244 private:
212 SkNullBlitter fNullBlitter; 245 SkNullBlitter fNullBlitter;
213 SkRectClipBlitter fRectBlitter; 246 SkRectClipBlitter fRectBlitter;
214 SkRgnClipBlitter fRgnBlitter; 247 SkRgnClipBlitter fRgnBlitter;
215 }; 248 };
216 249
217 #endif 250 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698