diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 21:35:54 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 21:35:54 +0000 |
commit | 840434d046cbaefb5a70875b7e364523c713c79b (patch) | |
tree | b55362ca094f48705624af7f6812964d1faeda1c /o3d | |
parent | f17863106dd6715f2c18b6fcccacd5f232f95831 (diff) | |
download | chromium_src-840434d046cbaefb5a70875b7e364523c713c79b.zip chromium_src-840434d046cbaefb5a70875b7e364523c713c79b.tar.gz chromium_src-840434d046cbaefb5a70875b7e364523c713c79b.tar.bz2 |
These are code changes required to make the GYP build work.
Mostly these are fixes to warnings (signed/unsigned mismatches
were the most common), and some changes to include paths.
I've updated the build.scons files and DEPS file to match these
changes so that the scons build will still function with these
changes.
Review URL: http://codereview.chromium.org/146047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19062 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/DEPS | 2 | ||||
-rw-r--r-- | o3d/breakpad/win/bluescreen_detector.cc | 3 | ||||
-rw-r--r-- | o3d/core/cross/canvas.cc | 2 | ||||
-rw-r--r-- | o3d/core/cross/canvas.h | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_paint.cc | 125 | ||||
-rw-r--r-- | o3d/core/cross/canvas_paint.h | 2 | ||||
-rw-r--r-- | o3d/core/cross/canvas_shader.cc | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_shader.h | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_utils.h | 2 | ||||
-rw-r--r-- | o3d/plugin/build.scons | 5 | ||||
-rw-r--r-- | o3d/plugin/cross/archive_request_static_glue.cc (renamed from o3d/plugin/cross/archive_request_glue.cc) | 2 | ||||
-rw-r--r-- | o3d/plugin/cross/archive_request_static_glue.h (renamed from o3d/plugin/cross/archive_request_glue.h) | 6 | ||||
-rw-r--r-- | o3d/plugin/cross/np_v8_bridge.h | 2 | ||||
-rw-r--r-- | o3d/plugin/idl/bounding_box.idl | 2 | ||||
-rw-r--r-- | o3d/plugin/idl/texture.idl | 8 | ||||
-rw-r--r-- | o3d/plugin/win/main_win.cc | 2 | ||||
-rw-r--r-- | o3d/serializer/cross/serializer.cc | 2 | ||||
-rw-r--r-- | o3d/serializer/cross/serializer_binary.cc | 16 | ||||
-rw-r--r-- | o3d/svn_paths.scons | 2 |
19 files changed, 154 insertions, 41 deletions
@@ -49,7 +49,7 @@ deps = { "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/scons@" + Var("o3d_code_rev"), "o3d/third_party/skia": - "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/skia@" + Var("o3d_code_rev"), + "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/skia/files@" + Var("o3d_code_rev"), "o3d/third_party/vectormath": "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/vectormath@" + Var("o3d_code_rev"), diff --git a/o3d/breakpad/win/bluescreen_detector.cc b/o3d/breakpad/win/bluescreen_detector.cc index 9cdd51f..0d68fb5 100644 --- a/o3d/breakpad/win/bluescreen_detector.cc +++ b/o3d/breakpad/win/bluescreen_detector.cc @@ -104,7 +104,8 @@ int MarkerFileManagerInterface::DetectStrayMarkerFiles() { // the machine was last booted int stray_file_count = 0; - for (int i = 0; i < marker_files.size(); ++i) { + for (vector<MarkerFileInfo>::size_type i = 0; + i < marker_files.size(); ++i) { const MarkerFileInfo &file_info = marker_files[i]; if (time_manager_->IsMarkerFileOld(file_info)) { diff --git a/o3d/core/cross/canvas.cc b/o3d/core/cross/canvas.cc index d196fcc..26fabbd 100644 --- a/o3d/core/cross/canvas.cc +++ b/o3d/core/cross/canvas.cc @@ -39,7 +39,7 @@ #include "core/cross/client.h" #include "core/cross/error.h" -#include "third_party/skia/files/include/core/SkPath.h" +#include "third_party/skia/include/core/SkPath.h" namespace o3d { diff --git a/o3d/core/cross/canvas.h b/o3d/core/cross/canvas.h index 07c39f0..5c9c62e 100644 --- a/o3d/core/cross/canvas.h +++ b/o3d/core/cross/canvas.h @@ -41,8 +41,8 @@ #include "core/cross/param.h" #include "core/cross/texture.h" -#include "third_party/skia/files/include/core/SkBitmap.h" -#include "third_party/skia/files/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkCanvas.h" namespace o3d { diff --git a/o3d/core/cross/canvas_paint.cc b/o3d/core/cross/canvas_paint.cc index fe56453..3e37877 100644 --- a/o3d/core/cross/canvas_paint.cc +++ b/o3d/core/cross/canvas_paint.cc @@ -37,14 +37,125 @@ #include "core/cross/canvas_utils.h" #include "core/cross/client.h" -#include "third_party/skia/files/include/core/SkDrawLooper.h" -#include "third_party/skia/files/include/core/SkPaint.h" -#include "third_party/skia/files/include/core/SkTypeface.h" -#include "third_party/skia/files/include/effects/SkBlurDrawLooper.h" -#include "third_party/skia/files/include/effects/SkStrokeDrawLooper.h" +#include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkDrawLooper.h" +#include "third_party/skia/include/core/SkPaint.h" +#include "third_party/skia/include/core/SkTypeface.h" +#include "third_party/skia/include/effects/SkBlurDrawLooper.h" namespace o3d { +namespace { + +/** StrokeDrawLooper This class draws an outline of the +* object, and then draws the original object in its original +* position. +*/ +class StrokeDrawLooper : public SkDrawLooper { + public: + StrokeDrawLooper(SkScalar radius, SkColor color); + virtual ~StrokeDrawLooper() {} + virtual void init(SkCanvas* canvas, SkPaint* paint); + virtual bool next(); + virtual void restore(); + + protected: + virtual Factory getFactory() { return CreateProc; } + void flatten(SkFlattenableWriteBuffer& buffer); + StrokeDrawLooper(SkFlattenableReadBuffer& buffer); + + private: + SkCanvas* fCanvas; + SkPaint* fPaint; + + // These are to save the state attributes that we want to change so + // we can restore them after we draw the stroke. + SkPaint::Style fSavedStyle; + SkScalar fSavedStrokeWidth; + SkColor fSavedColor; + + // These are the attribues of the stroke. + SkScalar fRadius; + SkColor fColor; + + // Possible machine states for this object. + enum State { + kBeforeEdge, + kAfterEdge, + kDone, + }; + State fState; + + // Factory method for ressurecting a StrokeDrawLooper. + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(StrokeDrawLooper, (buffer)); } + + typedef SkDrawLooper INHERITED; +}; + +StrokeDrawLooper::StrokeDrawLooper(SkScalar radius, SkColor color) + : fColor(color), fRadius(radius) { +} + +void StrokeDrawLooper::init(SkCanvas* canvas, SkPaint* paint) { + fState = kBeforeEdge; + fCanvas = canvas; + fPaint = paint; +} + +bool StrokeDrawLooper::next() { + switch (fState) { + case kBeforeEdge: + // Save the original values. + fSavedStyle = fPaint->getStyle(); + fSavedStrokeWidth = fPaint->getStrokeWidth(); + fSavedColor = fPaint->getColor(); + + // Override with stroke values. + fPaint->setColor(fColor); + fPaint->setStrokeWidth(fRadius); + fPaint->setStyle(SkPaint::kStroke_Style); + + // Change states. + fState = kAfterEdge; + return true; + case kAfterEdge: + // Restore original values. + fPaint->setColor(fSavedColor); + fPaint->setStrokeWidth(fSavedStrokeWidth); + fPaint->setStyle(fSavedStyle); + + // Now we're done. + fState = kDone; + return true; + default: + SkASSERT(kDone == fState); + return false; + } +} + +void StrokeDrawLooper::restore() { + if (kAfterEdge == fState) { + fPaint->setColor(fSavedColor); + fPaint->setStrokeWidth(fSavedStrokeWidth); + fPaint->setStyle(fSavedStyle); + fState = kDone; + } +} + +void StrokeDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) { + buffer.writeScalar(fRadius); + buffer.write32(fColor); +} + +StrokeDrawLooper::StrokeDrawLooper(SkFlattenableReadBuffer& buffer) { + fRadius = buffer.readScalar(); + fColor = buffer.readU32(); +} + +} // end anonymous namespace + O3D_DEFN_CLASS(CanvasPaint, ParamObject); static SkPaint::Align ToSKAlign(CanvasPaint::TextAlign align) { @@ -88,8 +199,8 @@ void CanvasPaint::UpdateNativePaint() { // Note that shadow and ouline cannot both be active at the same time. if (outline_radius_ != 0.0) { - SkDrawLooper* l = new SkStrokeDrawLooper(SkFloatToScalar(outline_radius_), - Float4ToSkColor(outline_color_)); + SkDrawLooper* l = new StrokeDrawLooper(SkFloatToScalar(outline_radius_), + Float4ToSkColor(outline_color_)); sk_paint_.setLooper(l); l->unref(); } else if (shadow_radius_ != 0.0) { diff --git a/o3d/core/cross/canvas_paint.h b/o3d/core/cross/canvas_paint.h index ac76a70..aaec72a 100644 --- a/o3d/core/cross/canvas_paint.h +++ b/o3d/core/cross/canvas_paint.h @@ -39,7 +39,7 @@ #include "core/cross/param.h" #include "core/cross/canvas_shader.h" -#include "third_party/skia/files/include/core/SkPaint.h" +#include "third_party/skia/include/core/SkPaint.h" namespace o3d { diff --git a/o3d/core/cross/canvas_shader.cc b/o3d/core/cross/canvas_shader.cc index 9a5cb93..aeff7df 100644 --- a/o3d/core/cross/canvas_shader.cc +++ b/o3d/core/cross/canvas_shader.cc @@ -38,8 +38,8 @@ #include "core/cross/canvas_utils.h" #include "core/cross/error.h" -#include "third_party/skia/files/include/core/SkShader.h" -#include "third_party/skia/files/include/effects/SkGradientShader.h" +#include "third_party/skia/include/core/SkShader.h" +#include "third_party/skia/include/effects/SkGradientShader.h" namespace o3d { diff --git a/o3d/core/cross/canvas_shader.h b/o3d/core/cross/canvas_shader.h index ac86926..cf9fd0b 100644 --- a/o3d/core/cross/canvas_shader.h +++ b/o3d/core/cross/canvas_shader.h @@ -40,8 +40,8 @@ #include "core/cross/param_object.h" #include "core/cross/param.h" -#include "third_party/skia/files/include/core/SkColor.h" -#include "third_party/skia/files/include/core/SkPoint.h" +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkPoint.h" class SkShader; diff --git a/o3d/core/cross/canvas_utils.h b/o3d/core/cross/canvas_utils.h index 36e400e..87ce013 100644 --- a/o3d/core/cross/canvas_utils.h +++ b/o3d/core/cross/canvas_utils.h @@ -34,7 +34,7 @@ #define O3D_CORE_CROSS_CANVAS_UTILS_H_ #include "core/cross/float_n.h" -#include "third_party/skia/files/include/core/SkColor.h" +#include "third_party/skia/include/core/SkColor.h" // Helper function to convert from Float4 to an SkColor static SkColor Float4ToSkColor(const o3d::Float4& color) { diff --git a/o3d/plugin/build.scons b/o3d/plugin/build.scons index e6c344a..666cd7a 100644 --- a/o3d/plugin/build.scons +++ b/o3d/plugin/build.scons @@ -82,7 +82,8 @@ env.Append( '$NIXYSA_STATIC_GLUE', '$SCONSTRUCT_DIR/plugin/win', # for RES resource.h '$WTL_71_DIR/include', - ], + '$THIRD_PARTY', + ], LIBPATH = [ '$NACL_LIB_DIR', ], @@ -180,7 +181,7 @@ AUTOGEN_CC_FILES = [f for f in AUTOGEN_OUTPUT if f.suffix == '.cc'] inputs = AUTOGEN_CC_FILES + [ 'cross/async_loading.cc', - 'cross/archive_request_glue.cc', + 'cross/archive_request_static_glue.cc', 'cross/blacklist.cc', 'cross/o3d_glue.cc', 'cross/np_v8_bridge.cc', diff --git a/o3d/plugin/cross/archive_request_glue.cc b/o3d/plugin/cross/archive_request_static_glue.cc index 704aaa7..c11fd1c 100644 --- a/o3d/plugin/cross/archive_request_glue.cc +++ b/o3d/plugin/cross/archive_request_static_glue.cc @@ -30,7 +30,7 @@ */ -#include "plugin/cross/archive_request_glue.h" +#include "plugin/cross/archive_request_static_glue.h" #include "base/basictypes.h" #include "plugin/cross/stream_manager.h" diff --git a/o3d/plugin/cross/archive_request_glue.h b/o3d/plugin/cross/archive_request_static_glue.h index f9f1384..199de08 100644 --- a/o3d/plugin/cross/archive_request_glue.h +++ b/o3d/plugin/cross/archive_request_static_glue.h @@ -32,8 +32,8 @@ // This file declares the glue for FileRequest actions. -#ifndef O3D_PLUGIN_ARCHIVE_REQUEST_GLUE_H_ -#define O3D_PLUGIN_ARCHIVE_REQUEST_GLUE_H_ +#ifndef O3D_PLUGIN_ARCHIVE_REQUEST_STATIC_GLUE_H_ +#define O3D_PLUGIN_ARCHIVE_REQUEST_STATIC_GLUE_H_ #include "core/cross/callback.h" #include "core/cross/types.h" @@ -63,4 +63,4 @@ void userglue_method_send(void *plugin_data, } // namespace namespace_o3d } // namespace glue -#endif // O3D_PLUGIN_ARCHIVE_REQUEST_GLUE_H_ +#endif // O3D_PLUGIN_ARCHIVE_REQUEST_STATIC_GLUE_H_ diff --git a/o3d/plugin/cross/np_v8_bridge.h b/o3d/plugin/cross/np_v8_bridge.h index 779a5a3..150a3c2 100644 --- a/o3d/plugin/cross/np_v8_bridge.h +++ b/o3d/plugin/cross/np_v8_bridge.h @@ -62,7 +62,7 @@ #undef Value #endif -#include "third_party/v8/include/v8.h" +#include "v8/include/v8.h" namespace o3d { diff --git a/o3d/plugin/idl/bounding_box.idl b/o3d/plugin/idl/bounding_box.idl index b8ac932..1904f59 100644 --- a/o3d/plugin/idl/bounding_box.idl +++ b/o3d/plugin/idl/bounding_box.idl @@ -143,7 +143,7 @@ class BoundingBox { O3D_ERROR(service_locator) << "BoundingBox: expected 2 values, got " << values.size(); } else { - for (int i = 0; i < values.size(); ++i) { + for (std::vector<float>::size_type i = 0; i < values.size(); ++i) { if (values[i].size() != 3) { o3d::ServiceLocator* service_locator = static_cast<glue::_o3d::PluginObject*>( diff --git a/o3d/plugin/idl/texture.idl b/o3d/plugin/idl/texture.idl index cc470c0..7039a9e 100644 --- a/o3d/plugin/idl/texture.idl +++ b/o3d/plugin/idl/texture.idl @@ -268,7 +268,7 @@ namespace o3d { source_x -= destination_x; destination_x = 0; } - if (destination_x + copy_width > texture_width) { + if (destination_x + copy_width > static_cast<int>(texture_width)) { copy_width -= destination_x + copy_width - texture_width; } @@ -277,7 +277,7 @@ namespace o3d { source_y -= destination_y; destination_y = 0; } - if (destination_y + copy_height > texture_height) { + if (destination_y + copy_height > static_cast<int>(texture_height)) { copy_height -= destination_y + copy_height - texture_height; } @@ -303,7 +303,7 @@ namespace o3d { (destination_y * texture_width + destination_x) * num_components; while (copy_height > 0) { for (int xx = 0; xx < copy_width; ++xx) { - for (int element = 0; element < num_components; ++element) { + for (unsigned element = 0; element < num_components; ++element) { destination[element] = Vectormath::Aos::FloatToHalf( source[swizzle[element]]); } @@ -323,7 +323,7 @@ namespace o3d { (destination_y * texture_width + destination_x) * num_components; while (copy_height > 0) { for (int xx = 0; xx < copy_width; ++xx) { - for (int element = 0; element < num_components; ++element) { + for (unsigned element = 0; element < num_components; ++element) { destination[element] = source[swizzle[element]]; } destination += num_components; diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc index 1f1b14d..6107067 100644 --- a/o3d/plugin/win/main_win.cc +++ b/o3d/plugin/win/main_win.cc @@ -442,7 +442,7 @@ static LRESULT HandleDragAndDrop(PluginObject *obj, WPARAM wParam) { path_to_use = path.get(); #endif - for (int i = 0; i < num_chars; ++i) { + for (UINT i = 0; i < num_chars; ++i) { if (path_to_use[i] == '\\') { path_to_use[i] = '/'; } diff --git a/o3d/serializer/cross/serializer.cc b/o3d/serializer/cross/serializer.cc index f9266af..066ce30 100644 --- a/o3d/serializer/cross/serializer.cc +++ b/o3d/serializer/cross/serializer.cc @@ -756,7 +756,7 @@ void Serializer::SerializePack(Pack* pack) { void Serializer::SerializePackBinary(Pack* pack) { std::vector<ObjectBase*> objects = pack->GetByClass<ObjectBase>(); - for (int i = 0; i < objects.size(); ++i) { + for (std::vector<ObjectBase*>::size_type i = 0; i < objects.size(); ++i) { binary_visitor_->Accept(objects[i]); } } diff --git a/o3d/serializer/cross/serializer_binary.cc b/o3d/serializer/cross/serializer_binary.cc index 9b7f523..56793c4 100644 --- a/o3d/serializer/cross/serializer_binary.cc +++ b/o3d/serializer/cross/serializer_binary.cc @@ -80,7 +80,7 @@ void SerializeBuffer(const Buffer &buffer, MemoryBuffer<uint8> *output) { stream.WriteLittleEndianInt32(static_cast<int32>(num_fields)); // Write out the specification for the fields - for (int i = 0; i < num_fields; ++i) { + for (size_t i = 0; i < num_fields; ++i) { const Field &field = *buffer.fields()[i]; // Determine the FIELDID code we need to write out @@ -110,7 +110,7 @@ void SerializeBuffer(const Buffer &buffer, MemoryBuffer<uint8> *output) { // Write out the data for each field // Write out the specification for the fields - for (int i = 0; i < num_fields; ++i) { + for (size_t i = 0; i < num_fields; ++i) { const Field &field = *buffer.fields()[i]; MemoryBuffer<uint8> field_data(field.size() * num_elements); @@ -127,7 +127,7 @@ void SerializeBuffer(const Buffer &buffer, MemoryBuffer<uint8> *output) { field.num_components(), num_elements); // Write out as little endian float32 - for (int i = 0; i < nitems; ++i) { + for (size_t i = 0; i < nitems; ++i) { stream.WriteLittleEndianFloat32(float_destination[i]); } } else if (field.IsA(UInt32Field::GetApparentClass())) { @@ -138,7 +138,7 @@ void SerializeBuffer(const Buffer &buffer, MemoryBuffer<uint8> *output) { field.num_components(), num_elements); // Write out as little endian int32 - for (int i = 0; i < nitems; ++i) { + for (size_t i = 0; i < nitems; ++i) { stream.WriteLittleEndianInt32(int_destination[i]); } } else if (field.IsA(UByteNField::GetApparentClass())) { @@ -186,7 +186,7 @@ void SerializeCurve(const Curve &curve, MemoryBuffer<uint8> *output) { stream.WriteLittleEndianInt32(1); - for (int i = 0; i < num_keys; ++i) { + for (size_t i = 0; i < num_keys; ++i) { const CurveKey &key = *curve.GetKey(i); // determine the KeyType based on the key's class @@ -227,7 +227,7 @@ void SerializeSkin(const Skin &skin, MemoryBuffer<uint8> *output) { // Count up total number of individual influences size_t total_influence_count = 0; - for (int i = 0; i < influences_array_size; ++i) { + for (size_t i = 0; i < influences_array_size; ++i) { total_influence_count += influences_array[i].size(); } @@ -248,14 +248,14 @@ void SerializeSkin(const Skin &skin, MemoryBuffer<uint8> *output) { // write out version stream.WriteLittleEndianInt32(1); - for (int i = 0; i < influences_array_size; ++i) { + for (size_t i = 0; i < influences_array_size; ++i) { const Skin::Influences &influences = influences_array[i]; // Write the influence count for this Influences object size_t influence_count = influences.size(); stream.WriteLittleEndianInt32(static_cast<int32>(influence_count)); - for (int j = 0; j < influence_count; ++j) { + for (size_t j = 0; j < influence_count; ++j) { const Skin::Influence &influence = influences[j]; stream.WriteLittleEndianInt32(influence.matrix_index); stream.WriteLittleEndianFloat32(influence.weight); diff --git a/o3d/svn_paths.scons b/o3d/svn_paths.scons index ad3957c..019a618 100644 --- a/o3d/svn_paths.scons +++ b/o3d/svn_paths.scons @@ -74,7 +74,7 @@ env.Replace( SELENIUM_JAVA_DIR = '$THIRD_PARTY/java/selenium/rev2478_mod', SELENIUM_PYTHON_DIR = '$THIRD_PARTY/py/selenium', # TODO: pull from SVN with gclient ? - SKIA_DIR = '$THIRD_PARTY/skia/files', + SKIA_DIR = '$THIRD_PARTY/skia', # TODO: pull from SVN with gclient ? V8_SRC_DIR = '$THIRD_PARTY/v8', WIX_DIR = '$THIRD_PARTY/wix_2_0_4221/files', |