From 4debcac8c38cae17a01e697578719c60a068052f Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Mon, 14 May 2012 16:33:36 +0000 Subject: [PATCH] Debug Windows compiler complaint fixes http://codereview.appspot.com/6208055/ git-svn-id: http://skia.googlecode.com/svn/trunk@3924 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/InterpBench.cpp | 19 +++++++++++++++---- gyp/gpu.gyp | 2 -- samplecode/SampleRegion.cpp | 10 ++++++---- src/gpu/gl/debug/GrFBBindableObj.cpp | 9 --------- src/gpu/gl/debug/GrRenderBufferObj.cpp | 9 --------- src/pdf/SkPDFDocument.cpp | 2 +- tests/DrawBitmapRectTest.cpp | 20 ++++++++++++++------ tests/MathTest.cpp | 10 ++++++---- tests/PDFPrimitivesTest.cpp | 8 +++----- tests/ToUnicode.cpp | 2 -- 10 files changed, 45 insertions(+), 46 deletions(-) delete mode 100644 src/gpu/gl/debug/GrFBBindableObj.cpp delete mode 100644 src/gpu/gl/debug/GrRenderBufferObj.cpp diff --git a/bench/InterpBench.cpp b/bench/InterpBench.cpp index 1db832d..89841f8 100644 --- a/bench/InterpBench.cpp +++ b/bench/InterpBench.cpp @@ -71,10 +71,21 @@ protected: int64_t step = (int64_t)(dx * 65536 * 655536); SkFixed tmp; for (int i = 0; i < count; i += 4) { - tmp = curr >> 16; dst[i + 0] = TILE(tmp, count); curr += step; - tmp = curr >> 16; dst[i + 1] = TILE(tmp, count); curr += step; - tmp = curr >> 16; dst[i + 2] = TILE(tmp, count); curr += step; - tmp = curr >> 16; dst[i + 3] = TILE(tmp, count); curr += step; + tmp = (SkFixed)(curr >> 16); + dst[i + 0] = TILE(tmp, count); + curr += step; + + tmp = (SkFixed)(curr >> 16); + dst[i + 1] = TILE(tmp, count); + curr += step; + + tmp = (SkFixed)(curr >> 16); + dst[i + 2] = TILE(tmp, count); + curr += step; + + tmp = (SkFixed)(curr >> 16); + dst[i + 3] = TILE(tmp, count); + curr += step; } } private: diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp index 9ca225e..04cb4e3 100644 --- a/gyp/gpu.gyp +++ b/gyp/gpu.gyp @@ -320,9 +320,7 @@ '../src/gpu/gl/debug/GrBufferObj.h', '../src/gpu/gl/debug/GrBufferObj.cpp', '../src/gpu/gl/debug/GrFBBindableObj.h', - '../src/gpu/gl/debug/GrFBBindableObj.cpp', '../src/gpu/gl/debug/GrRenderBufferObj.h', - '../src/gpu/gl/debug/GrRenderBufferObj.cpp', '../src/gpu/gl/debug/GrTextureObj.h', '../src/gpu/gl/debug/GrTextureObj.cpp', '../src/gpu/gl/debug/GrTextureUnitObj.h', diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp index a46b488..b4d540c 100644 --- a/samplecode/SampleRegion.cpp +++ b/samplecode/SampleRegion.cpp @@ -28,8 +28,10 @@ static void test_strokerect(SkCanvas* canvas) { SkScalar dy = 20; SkPath path; - path.addRect(0.0f, 0.0f, width, height, SkPath::kCW_Direction); - SkRect r = SkRect::MakeWH(width, height); + path.addRect(0.0f, 0.0f, + SkIntToScalar(width), SkIntToScalar(height), + SkPath::kCW_Direction); + SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); SkCanvas c(bitmap); c.translate(dx, dy); @@ -46,7 +48,7 @@ static void test_strokerect(SkCanvas* canvas) { // use the path c.clear(0); c.drawPath(path, paint); - canvas->drawBitmap(bitmap, 2*width, 0, NULL); + canvas->drawBitmap(bitmap, SkIntToScalar(2*width), 0, NULL); } static void drawFadingText(SkCanvas* canvas, @@ -74,7 +76,7 @@ static void drawFadingText(SkCanvas* canvas, // pos[1] value is where we start to fade, relative to the width // of our pts[] array. - const SkScalar pos[] = { 0, SkFloatToScalar(0.9), SK_Scalar1 }; + const SkScalar pos[] = { 0, SkFloatToScalar(0.9f), SK_Scalar1 }; SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 3, SkShader::kClamp_TileMode); diff --git a/src/gpu/gl/debug/GrFBBindableObj.cpp b/src/gpu/gl/debug/GrFBBindableObj.cpp deleted file mode 100644 index dbab2d7..0000000 --- a/src/gpu/gl/debug/GrFBBindableObj.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "GrFBBindableObj.h" \ No newline at end of file diff --git a/src/gpu/gl/debug/GrRenderBufferObj.cpp b/src/gpu/gl/debug/GrRenderBufferObj.cpp deleted file mode 100644 index b7641ca..0000000 --- a/src/gpu/gl/debug/GrRenderBufferObj.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "GrRenderBufferObj.h" diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp index 74daf00..3b9b686 100644 --- a/src/pdf/SkPDFDocument.cpp +++ b/src/pdf/SkPDFDocument.cpp @@ -263,7 +263,7 @@ void SkPDFDocument::emitFooter(SkWStream* stream, int64_t objCount) { // TODO(vandebo): Linearized format will take a Prev entry too. // TODO(vandebo): PDF/A requires an ID entry. - fTrailerDict->insertInt("Size", objCount); + fTrailerDict->insertInt("Size", int(objCount)); fTrailerDict->insert("Root", new SkPDFObjRef(fDocCatalog.get()))->unref(); } diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 084bdf2..e11acbc 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -41,9 +41,13 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter, SkMatrix matrix; SkCanvas c(dev); - matrix.setAll(-119.34097, -43.436558, 93489.945, - 43.436558, -119.34097, 123.98426, - 0, 0, 1); + matrix.setAll(SkFloatToScalar(-119.34097f), + SkFloatToScalar(-43.436558f), + SkFloatToScalar(93489.945f), + SkFloatToScalar(43.436558f), + SkFloatToScalar(-119.34097f), + SkFloatToScalar(123.98426f), + 0, 0, SK_Scalar1); c.concat(matrix); SkBitmap bm; @@ -53,9 +57,13 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter, SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); - matrix.setAll(0.0078740157, 0, 249, - 0, 0.0078740157, 239, - 0, 0, 1); + matrix.setAll(SkFloatToScalar(0.0078740157f), + 0, + SkIntToScalar(249), + 0, + SkFloatToScalar(0.0078740157f), + SkIntToScalar(239), + 0, 0, SK_Scalar1); s->setLocalMatrix(matrix); SkPaint paint; diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index fe162b1..eec9dbe 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -418,11 +418,13 @@ static void TestMath(skiatest::Reporter* reporter) { // These random values are being treated as 32-bit-patterns, not as // ints; calling SkIntToScalar() here produces crashes. - p.setLength(rand.nextS(), - rand.nextS(), SK_Scalar1); + p.setLength((SkScalar) rand.nextS(), + (SkScalar) rand.nextS(), + SK_Scalar1); check_length(reporter, p, SK_Scalar1); - p.setLength(rand.nextS() >> 13, - rand.nextS() >> 13, SK_Scalar1); + p.setLength((SkScalar) (rand.nextS() >> 13), + (SkScalar) (rand.nextS() >> 13), + SK_Scalar1); check_length(reporter, p, SK_Scalar1); } diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index d1ed217..000ebea 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -7,8 +7,6 @@ */ -#include - #include "Test.h" #include "SkData.h" #include "SkFlate.h" @@ -89,9 +87,9 @@ static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj, static void SimpleCheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj, - const std::string& expectedResult) { - CheckObjectOutput(reporter, obj, expectedResult.c_str(), - expectedResult.length(), true, false); + const char* expectedResult) { + CheckObjectOutput(reporter, obj, expectedResult, + strlen(expectedResult), true, false); } static void TestPDFStream(skiatest::Reporter* reporter) { diff --git a/tests/ToUnicode.cpp b/tests/ToUnicode.cpp index c0a945a..99e9ef6 100644 --- a/tests/ToUnicode.cpp +++ b/tests/ToUnicode.cpp @@ -7,8 +7,6 @@ */ -#include - #include "Test.h" #include "SkData.h" #include "SkPDFTypes.h" -- 2.7.4