diff options
author | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 20:50:45 +0000 |
---|---|---|
committer | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 20:50:45 +0000 |
commit | faad2573b247e6c6721d086bdf7e6f056f1ef1b3 (patch) | |
tree | 81a66fc0b531528c7629f2188ce79f7857691853 /native_client_sdk/src/examples | |
parent | 759017e03abb02554ad06a1745290631c43d7751 (diff) | |
download | chromium_src-faad2573b247e6c6721d086bdf7e6f056f1ef1b3.zip chromium_src-faad2573b247e6c6721d086bdf7e6f056f1ef1b3.tar.gz chromium_src-faad2573b247e6c6721d086bdf7e6f056f1ef1b3.tar.bz2 |
Build cleanups
Speed up slow "pong" example.
Update "updater" to support new manifest format.
Fix '.svn' exclude.
Add list of files for SDK
Add list of examples for SDK
Committing TBR to green SDK tree, SDK changes do not affect Chrome.
TBR= bradnelson@chromium.org
BUG= 109207
Review URL: https://chromiumcodereview.appspot.com/9383038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src/examples')
-rw-r--r-- | native_client_sdk/src/examples/Makefile | 5 | ||||
-rw-r--r-- | native_client_sdk/src/examples/dlopen/dlopen.cc | 3 | ||||
-rw-r--r-- | native_client_sdk/src/examples/pong/view.cc | 7 |
3 files changed, 7 insertions, 8 deletions
diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile index 468269e..6f022d5 100644 --- a/native_client_sdk/src/examples/Makefile +++ b/native_client_sdk/src/examples/Makefile @@ -15,7 +15,6 @@ PROJECTS+=tumbler # Define the default target all: - # # Target Macro # @@ -26,7 +25,7 @@ define TARGET TARGET_LIST+=$(1)_TARGET .PHONY: $(1)_TARGET $(1)_TARGET: - +cd $(1) && $(MAKE) + +$(MAKE) -C $(1) endef @@ -35,7 +34,7 @@ $(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj)))) all: $(TARGET_LIST) - echo "Done building targets, running webserver." + echo "Done building targets." RUN: all echo "Staring up python webserver." diff --git a/native_client_sdk/src/examples/dlopen/dlopen.cc b/native_client_sdk/src/examples/dlopen/dlopen.cc index 27f7c7c..4d8bf89 100644 --- a/native_client_sdk/src/examples/dlopen/dlopen.cc +++ b/native_client_sdk/src/examples/dlopen/dlopen.cc @@ -81,7 +81,8 @@ class dlOpenInstance : public pp::Instance { if(_dlhandle == NULL) { logmsg("libeightball.so did not load"); } else { - _eightball = (TYPE_eightball) dlsym(this->_dlhandle, "Magic8Ball"); + intptr_t offset = (intptr_t) dlsym(this->_dlhandle, "Magic8Ball"); + _eightball = (TYPE_eightball) offset; if (NULL == _eightball) { std::string ballmessage = "dlsym() returned NULL: "; ballmessage += dlerror(); diff --git a/native_client_sdk/src/examples/pong/view.cc b/native_client_sdk/src/examples/pong/view.cc index 2938275..0801712 100644 --- a/native_client_sdk/src/examples/pong/view.cc +++ b/native_client_sdk/src/examples/pong/view.cc @@ -75,6 +75,7 @@ void View::Draw() { // Clear the buffer const int32_t height = pixel_buffer_->size().height(); const int32_t width = pixel_buffer_->size().width(); + const float radius2 = (ball_rect_.width() / 2) * (ball_rect_.width() / 2); for (int32_t py = 0; py < height; ++py) { for (int32_t px = 0; px < width; ++px) { const int32_t pos = px + py * width; @@ -85,13 +86,11 @@ void View::Draw() { color |= kWhiteMask; } else { pp::Point center_point = ball_rect_.CenterPoint(); - float radius = ball_rect_.width() / 2; float distance_x = px - center_point.x(); float distance_y = py - center_point.y(); - float distance = - sqrt(distance_x * distance_x + distance_y * distance_y); + float distance2 = distance_x * distance_x + distance_y * distance_y; // Draw the ball - if (distance <= radius) + if (distance2 <= radius2) color |= kWhiteMask; } pixels[pos] = color; |