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

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

Issue 1088143002: add blitter api for aa-hairlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkScan_Antihair.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
13 #include "SkBitmap.h" 11 #include "SkBitmap.h"
14 #include "SkBitmapProcShader.h" 12 #include "SkBitmapProcShader.h"
15 #include "SkMask.h" 13 #include "SkMask.h"
16 #include "SkMatrix.h" 14 #include "SkMatrix.h"
17 #include "SkPaint.h" 15 #include "SkPaint.h"
18 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
19 #include "SkRegion.h" 17 #include "SkRegion.h"
(...skipping 28 matching lines...) Expand all
48 /// Blit a pattern of pixels defined by a rectangle-clipped mask; 46 /// Blit a pattern of pixels defined by a rectangle-clipped mask;
49 /// typically used for text. 47 /// typically used for text.
50 virtual void blitMask(const SkMask&, const SkIRect& clip); 48 virtual void blitMask(const SkMask&, const SkIRect& clip);
51 49
52 /** If the blitter just sets a single value for each pixel, return the 50 /** 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 51 bitmap it draws into, and assign value. If not, return NULL and ignore
54 the value parameter. 52 the value parameter.
55 */ 53 */
56 virtual const SkBitmap* justAnOpaqueColor(uint32_t* value); 54 virtual const SkBitmap* justAnOpaqueColor(uint32_t* value);
57 55
56 // (x, y), (x + 1, y)
57 void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
58 int16_t runs[3];
59 uint8_t aa[2];
60
61 runs[0] = 1;
62 runs[1] = 1;
63 runs[2] = 0;
64 aa[0] = SkToU8(a0);
65 aa[1] = SkToU8(a1);
66 this->blitAntiH(x, y, aa, runs);
67 }
68
69 // (x, y), (x, y + 1)
70 void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
71 int16_t runs[2];
72 uint8_t aa[1];
73
74 runs[0] = 1;
75 runs[1] = 0;
76 aa[0] = SkToU8(a0);
77 this->blitAntiH(x, y, aa, runs);
78 // reset in case the clipping blitter modified runs
79 runs[0] = 1;
80 runs[1] = 0;
81 aa[0] = SkToU8(a1);
82 this->blitAntiH(x, y + 1, aa, runs);
83 }
84
58 /** 85 /**
59 * Special method just to identify the null blitter, which is returned 86 * Special method just to identify the null blitter, which is returned
60 * from Choose() if the request cannot be fulfilled. Default impl 87 * from Choose() if the request cannot be fulfilled. Default impl
61 * returns false. 88 * returns false.
62 */ 89 */
63 virtual bool isNullBlitter() const; 90 virtual bool isNullBlitter() const;
64 91
65 /** 92 /**
66 * Special methods for SkShaderBlitter. On all other classes this is a no-o p. 93 * Special methods for SkShaderBlitter. On all other classes this is a no-o p.
67 */ 94 */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip, 235 SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip,
209 const SkIRect* bounds = NULL); 236 const SkIRect* bounds = NULL);
210 237
211 private: 238 private:
212 SkNullBlitter fNullBlitter; 239 SkNullBlitter fNullBlitter;
213 SkRectClipBlitter fRectBlitter; 240 SkRectClipBlitter fRectBlitter;
214 SkRgnClipBlitter fRgnBlitter; 241 SkRgnClipBlitter fRgnBlitter;
215 }; 242 };
216 243
217 #endif 244 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkScan_Antihair.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698