diff options
author | 2017-11-20 22:11:30 +0000 | |
---|---|---|
committer | 2017-11-20 22:11:39 +0000 | |
commit | c02cb8a86ce801f471a8cf7bd46880648c48f089 (patch) | |
tree | 2c11e8b9a9e8f53dd0582dcbacf3dd3e34ae5f5c /samplecode | |
parent | 575e06cd9b9f1e73a319d38f78f4b368df6024a3 (diff) |
Revert "Use int when possible to calculate atlas indices in shaders."
This reverts commit 999ec57291dc7cf1d8e3a745627670e6cadc1c12.
Reason for revert: Causing issues with NexusPlayer Vulkan.
Original change's description:
> Use int when possible to calculate atlas indices in shaders.
>
> On certain iOS devices half has a mantissa of only 10 bits, which is not
> enough to perform the floating point trickery to get the lower bits
> out of the "texture coordinates". Instead we use int if available, and
> float if not available.
>
> Also re-enables multitexturing for iOS and adds a sample which
> stresses the issue.
>
> Bug: skia:7285
> Change-Id: I365532c7cbbcca7c7753af209bef46e05be49e11
> Reviewed-on: https://skia-review.googlesource.com/71181
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I82801a73a2a8067588049b213f010ff25f4014f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7285
Reviewed-on: https://skia-review.googlesource.com/74001
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleFlutterAnimate.cpp | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/samplecode/SampleFlutterAnimate.cpp b/samplecode/SampleFlutterAnimate.cpp deleted file mode 100644 index 63b453b240..0000000000 --- a/samplecode/SampleFlutterAnimate.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SampleCode.h" -#include "SkAnimTimer.h" -#include "SkView.h" -#include "SkCanvas.h" -#include "SkUtils.h" -#include "SkColorPriv.h" -#include "SkColorFilter.h" -#include "SkImage.h" -#include "SkRandom.h" -#include "SkSystemEventTypes.h" -#include "SkTime.h" -#include "SkTypeface.h" -#include "Timer.h" - -#if SK_SUPPORT_GPU -#include "GrContext.h" -#endif - -class FlutterAnimateView : public SampleView { -public: - FlutterAnimateView() : fCurrTime(0), fResetTime(0) {} - -protected: - void onOnceBeforeDraw() override { - initChars(); - } - - // overrides from SkEventSink - bool onQuery(SkEvent* evt) override { - if (SampleCode::TitleQ(*evt)) { - SampleCode::TitleR(evt, "FlutterAnimate"); - return true; - } - - return this->INHERITED::onQuery(evt); - } - - void onDrawContent(SkCanvas* canvas) override { - SkPaint paint; - paint.setTypeface(SkTypeface::MakeFromFile("/skimages/samplefont.ttf")); - paint.setAntiAlias(true); - paint.setFilterQuality(kMedium_SkFilterQuality); - paint.setTextSize(50); - - canvas->clear(SK_ColorWHITE); - for (int i = 0; i < kNumChars; ++i) { - canvas->save(); - double rot = fChars[i].fStartRotation + (fChars[i].fEndRotation - fChars[i].fStartRotation)*fCurrTime/kDuration; - canvas->translate(fChars[i].fPosition.fX + 35,fChars[i].fPosition.fY - 50); - canvas->rotate(rot*180.0/SK_MScalarPI); - canvas->translate(-35,+50); - canvas->drawString(fChars[i].fChar, 0, 0, - paint); - canvas->restore(); - } - } - - bool onAnimate(const SkAnimTimer& timer) override { - fCurrTime = timer.secs() - fResetTime; - if (fCurrTime > kDuration) { - this->initChars(); - fResetTime = timer.secs(); - fCurrTime = 0; - } - - return true; - } - -private: - void initChars() { - for (int i = 0; i < kNumChars; ++i) { - char c = fRand.nextULessThan(26) + 65; - fChars[i].fChar.set(&c, 1); - fChars[i].fPosition = SkPoint::Make(fRand.nextF()*748 + 10, fRand.nextF()*1004 + 10); - fChars[i].fStartRotation = fRand.nextF(); - fChars[i].fEndRotation = fRand.nextF() * 20 - 10; - } - } - - static constexpr double kDuration = 5.0; - double fCurrTime; - double fResetTime; - SkRandom fRand; - - struct AnimatedChar { - SkString fChar; - SkPoint fPosition; - SkScalar fStartRotation; - SkScalar fEndRotation; - }; - static constexpr int kNumChars = 40; - AnimatedChar fChars[kNumChars]; - - typedef SampleView INHERITED; -}; - -////////////////////////////////////////////////////////////////////////////// - -static SkView* MyFactory() { return new FlutterAnimateView; } -static SkViewRegister reg(MyFactory); |