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

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

Issue 2054213002: Add documention on SkBlitter for runs, and small cleanups. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #include "SkBlitter.h" 8 #include "SkBlitter.h"
9 #include "SkAntiRun.h" 9 #include "SkAntiRun.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 while (--height >= 0) { 151 while (--height >= 0) {
152 int affectedRightBit = mask.fBounds.width() - 1; 152 int affectedRightBit = mask.fBounds.width() - 1;
153 ptrdiff_t rowBytes = (affectedRightBit >> 3) + 1; 153 ptrdiff_t rowBytes = (affectedRightBit >> 3) + 1;
154 SkASSERT(bits + rowBytes <= endOfImage); 154 SkASSERT(bits + rowBytes <= endOfImage);
155 U8CPU rightMask = generate_right_mask((affectedRightBit & 7) + 1 ); 155 U8CPU rightMask = generate_right_mask((affectedRightBit & 7) + 1 );
156 bits_to_runs(this, cx, cy, bits, 0xFF, rowBytes, rightMask); 156 bits_to_runs(this, cx, cy, bits, 0xFF, rowBytes, rightMask);
157 bits += maskRowBytes; 157 bits += maskRowBytes;
158 cy += 1; 158 cy += 1;
159 } 159 }
160 } else { 160 } else {
161 // Bits is calculated as the offset into the mask at the point {cx, cy} therfore, all 161 // Bits is calculated as the offset into the mask at the point {cx, cy} therefore, all
162 // addressing into the bit mask is relative to that point. Since thi s is an address 162 // addressing into the bit mask is relative to that point. Since thi s is an address
163 // calculated from a arbitrary bit in that byte, calculate the left most bit. 163 // calculated from a arbitrary bit in that byte, calculate the left most bit.
164 int bitsLeft = cx - ((cx - maskLeft) & 7); 164 int bitsLeft = cx - ((cx - maskLeft) & 7);
165 165
166 // Everything is relative to the bitsLeft. 166 // Everything is relative to the bitsLeft.
167 int leftEdge = cx - bitsLeft; 167 int leftEdge = cx - bitsLeft;
168 SkASSERT(leftEdge >= 0); 168 SkASSERT(leftEdge >= 0);
169 int rightEdge = clip.fRight - bitsLeft; 169 int rightEdge = clip.fRight - bitsLeft;
170 SkASSERT(rightEdge > leftEdge); 170 SkASSERT(rightEdge > leftEdge);
171 171
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 fShaderContext->~Context(); 1005 fShaderContext->~Context();
1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); 1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
1007 if (nullptr == ctx) { 1007 if (nullptr == ctx) {
1008 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call 1008 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call
1009 // the in-place destructor. 1009 // the in-place destructor.
1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec); 1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec);
1011 return false; 1011 return false;
1012 } 1012 }
1013 return true; 1013 return true;
1014 } 1014 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698