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

Unified Diff: src/gpu/GrContext.cpp

Issue 216503004: SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3a2bbe864ca184015bdd53f9833c0d52dbb41ae7..72b1c5d6925993fd1704644ffc1742e3944cd0e2 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -270,14 +270,14 @@ static void stretchImage(void* dst,
int srcW,
int srcH,
size_t bpp) {
- GrFixed dx = (srcW << 16) / dstW;
- GrFixed dy = (srcH << 16) / dstH;
+ SkFixed dx = (srcW << 16) / dstW;
+ SkFixed dy = (srcH << 16) / dstH;
- GrFixed y = dy >> 1;
+ SkFixed y = dy >> 1;
size_t dstXLimit = dstW*bpp;
for (int j = 0; j < dstH; ++j) {
- GrFixed x = dx >> 1;
+ SkFixed x = dx >> 1;
void* srcRow = (uint8_t*)src + (y>>16)*srcW*bpp;
void* dstRow = (uint8_t*)dst + j*dstW*bpp;
for (size_t i = 0; i < dstXLimit; i += bpp) {
@@ -295,7 +295,7 @@ namespace {
// position + local coordinate
extern const GrVertexAttrib gVertexAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding}
+ {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding}
};
};
@@ -342,9 +342,9 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
GrDrawTarget::AutoReleaseGeometry arg(fGpu, 4, 0);
if (arg.succeeded()) {
- GrPoint* verts = (GrPoint*) arg.vertices();
- verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(GrPoint));
- verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(GrPoint));
+ SkPoint* verts = (SkPoint*) arg.vertices();
+ verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(SkPoint));
+ verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(SkPoint));
fGpu->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4);
}
} else {
@@ -439,8 +439,8 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
if (kApprox_ScratchTexMatch == match) {
// bin by pow2 with a reasonable min
static const int MIN_SIZE = 16;
- desc.fWidth = GrMax(MIN_SIZE, GrNextPow2(desc.fWidth));
- desc.fHeight = GrMax(MIN_SIZE, GrNextPow2(desc.fHeight));
+ desc.fWidth = SkTMax(MIN_SIZE, GrNextPow2(desc.fWidth));
+ desc.fHeight = SkTMax(MIN_SIZE, GrNextPow2(desc.fHeight));
}
GrResource* resource = NULL;
@@ -580,7 +580,7 @@ void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) {
}
int GrContext::getMaxTextureSize() const {
- return GrMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
+ return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
}
int GrContext::getMaxRenderTargetSize() const {
@@ -680,7 +680,7 @@ void GrContext::dumpFontCache() const {
could use an indices array, and then only send 8 verts, but not sure that
would be faster.
*/
-static void setStrokeRectStrip(GrPoint verts[10], SkRect rect,
+static void setStrokeRectStrip(SkPoint verts[10], SkRect rect,
SkScalar width) {
const SkScalar rad = SkScalarHalf(width);
rect.sort();
@@ -856,7 +856,7 @@ void GrContext::drawRect(const GrPaint& paint,
GrPrimitiveType primType;
int vertCount;
- GrPoint* vertex = geo.positions();
+ SkPoint* vertex = geo.positions();
if (width > 0) {
vertCount = 10;
@@ -904,17 +904,17 @@ namespace {
extern const GrVertexAttrib gPosUVColorAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
- {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding },
- {kVec4ub_GrVertexAttribType, 2*sizeof(GrPoint), kColor_GrVertexAttribBinding}
+ {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding },
+ {kVec4ub_GrVertexAttribType, 2*sizeof(SkPoint), kColor_GrVertexAttribBinding}
};
extern const GrVertexAttrib gPosColorAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kColor_GrVertexAttribBinding},
+ {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
};
static void set_vertex_attributes(GrDrawState* drawState,
- const GrPoint* texCoords,
+ const SkPoint* texCoords,
const GrColor* colors,
int* colorOffset,
int* texOffset) {
@@ -922,14 +922,14 @@ static void set_vertex_attributes(GrDrawState* drawState,
*colorOffset = -1;
if (NULL != texCoords && NULL != colors) {
- *texOffset = sizeof(GrPoint);
- *colorOffset = 2*sizeof(GrPoint);
+ *texOffset = sizeof(SkPoint);
+ *colorOffset = 2*sizeof(SkPoint);
drawState->setVertexAttribs<gPosUVColorAttribs>(3);
} else if (NULL != texCoords) {
- *texOffset = sizeof(GrPoint);
+ *texOffset = sizeof(SkPoint);
drawState->setVertexAttribs<gPosUVColorAttribs>(2);
} else if (NULL != colors) {
- *colorOffset = sizeof(GrPoint);
+ *colorOffset = sizeof(SkPoint);
drawState->setVertexAttribs<gPosColorAttribs>(2);
} else {
drawState->setVertexAttribs<gPosColorAttribs>(1);
@@ -941,8 +941,8 @@ static void set_vertex_attributes(GrDrawState* drawState,
void GrContext::drawVertices(const GrPaint& paint,
GrPrimitiveType primitiveType,
int vertexCount,
- const GrPoint positions[],
- const GrPoint texCoords[],
+ const SkPoint positions[],
+ const SkPoint texCoords[],
const GrColor colors[],
const uint16_t indices[],
int indexCount) {
@@ -960,7 +960,7 @@ void GrContext::drawVertices(const GrPaint& paint,
set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset);
size_t vertexSize = drawState->getVertexSize();
- if (sizeof(GrPoint) != vertexSize) {
+ if (sizeof(SkPoint) != vertexSize) {
if (!geo.set(target, vertexCount, 0)) {
GrPrintf("Failed to get space for vertices!\n");
return;
@@ -968,10 +968,10 @@ void GrContext::drawVertices(const GrPaint& paint,
void* curVertex = geo.vertices();
for (int i = 0; i < vertexCount; ++i) {
- *((GrPoint*)curVertex) = positions[i];
+ *((SkPoint*)curVertex) = positions[i];
if (texOffset >= 0) {
- *(GrPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
+ *(SkPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
}
if (colorOffset >= 0) {
*(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i];

Powered by Google App Engine
This is Rietveld 408576698