From 45369a33bb78b6b76fafd63b1334151368dc9e2a Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Sun, 30 Sep 2012 11:30:01 +0000 Subject: [PATCH] samplecode: Avoid temporary variables of SkString type. Just like most of the other samples, just pass the name of the sample directly. R=epoger@google.com Review URL: https://codereview.appspot.com/6572047 git-svn-id: http://skia.googlecode.com/svn/trunk@5743 2bbb7eff-a529-9590-31e7-b0007b416f81 --- samplecode/SamplePatch.cpp | 6 ++---- samplecode/SamplePolyToPoly.cpp | 3 +-- samplecode/SampleTextAlpha.cpp | 3 +-- samplecode/SampleTextBox.cpp | 3 +-- samplecode/SampleVertices.cpp | 6 ++---- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp index a58999a..90aaf4c 100644 --- a/samplecode/SamplePatch.cpp +++ b/samplecode/SamplePatch.cpp @@ -259,10 +259,8 @@ public: protected: // overrides from SkEventSink virtual bool onQuery(SkEvent* evt) { - if (SampleCode::TitleQ(*evt)) - { - SkString str("Patch"); - SampleCode::TitleR(evt, str.c_str()); + if (SampleCode::TitleQ(*evt)) { + SampleCode::TitleR(evt, "Patch"); return true; } return this->INHERITED::onQuery(evt); diff --git a/samplecode/SamplePolyToPoly.cpp b/samplecode/SamplePolyToPoly.cpp index da527c2..88adae9 100644 --- a/samplecode/SamplePolyToPoly.cpp +++ b/samplecode/SamplePolyToPoly.cpp @@ -77,8 +77,7 @@ protected: // overrides from SkEventSink virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { - SkString str("PolyToPolyView"); - SampleCode::TitleR(evt, str.c_str()); + SampleCode::TitleR(evt, "PolyToPolyView"); return true; } return this->INHERITED::onQuery(evt); diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp index 6333588..ac24f08 100644 --- a/samplecode/SampleTextAlpha.cpp +++ b/samplecode/SampleTextAlpha.cpp @@ -53,8 +53,7 @@ protected: // overrides from SkEventSink virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { - SkString str("TextAlpha"); - SampleCode::TitleR(evt, str.c_str()); + SampleCode::TitleR(evt, "TextAlpha"); return true; } return this->INHERITED::onQuery(evt); diff --git a/samplecode/SampleTextBox.cpp b/samplecode/SampleTextBox.cpp index d8612db..a021dbd 100644 --- a/samplecode/SampleTextBox.cpp +++ b/samplecode/SampleTextBox.cpp @@ -63,8 +63,7 @@ protected: // overrides from SkEventSink virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { - SkString str("TextBox"); - SampleCode::TitleR(evt, str.c_str()); + SampleCode::TitleR(evt, "TextBox"); return true; } return this->INHERITED::onQuery(evt); diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp index d6dd7ea..bc02256 100644 --- a/samplecode/SampleVertices.cpp +++ b/samplecode/SampleVertices.cpp @@ -79,10 +79,8 @@ public: protected: // overrides from SkEventSink virtual bool onQuery(SkEvent* evt) { - if (SampleCode::TitleQ(*evt)) - { - SkString str("Vertices"); - SampleCode::TitleR(evt, str.c_str()); + if (SampleCode::TitleQ(*evt)) { + SampleCode::TitleR(evt, "Vertices"); return true; } return this->INHERITED::onQuery(evt); -- 2.7.4