0933bc9b67
This reverts commitcca2300559
. Reason for revert: think I guessed wrong about g32 -- unreverting Original change's description: > Revert "resources: remove most uses of GetResourcePath()" > > This reverts commit5093a539de
. > > Reason for revert: google3 seems broken > > Original change's description: > > resources: remove most uses of GetResourcePath() > > > > Going forward, we will standardize on GetResourceAsData(), which will > > make it easier to run tests in environments without access to the > > filesystem. > > > > Also: GetResourceAsData() complains when a resource is missing. > > This is usually an error. > > > > Change-Id: Iaf70b71b0ca5ed8cd1a5538a60ef185ae8736188 > > Reviewed-on: https://skia-review.googlesource.com/82642 > > Reviewed-by: Hal Canary <halcanary@google.com> > > Commit-Queue: Hal Canary <halcanary@google.com> > > TBR=halcanary@google.com,scroggo@google.com > > Change-Id: Ic5a7c0167c995a672e6b06dc92abe00564432214 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/83001 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=halcanary@google.com,scroggo@google.com,reed@google.com Change-Id: I5a46e4de61186a8a5eb9cacd3275e24e311d5a07 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/82942 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
40 lines
962 B
C++
40 lines
962 B
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef Resources_DEFINED
|
|
#define Resources_DEFINED
|
|
|
|
#include "SkImage.h"
|
|
#include "SkString.h"
|
|
|
|
class SkBitmap;
|
|
class SkData;
|
|
class SkStreamAsset;
|
|
class SkTypeface;
|
|
|
|
SkString GetResourcePath(const char* resource = "");
|
|
|
|
void SetResourcePath(const char* );
|
|
|
|
bool DecodeDataToBitmap(sk_sp<SkData> data, SkBitmap* dst);
|
|
|
|
sk_sp<SkData> GetResourceAsData(const char* resource);
|
|
|
|
inline bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) {
|
|
return DecodeDataToBitmap(GetResourceAsData(resource), dst);
|
|
}
|
|
|
|
inline sk_sp<SkImage> GetResourceAsImage(const char* resource) {
|
|
return SkImage::MakeFromEncoded(GetResourceAsData(resource));
|
|
}
|
|
|
|
std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource);
|
|
|
|
sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource);
|
|
|
|
#endif // Resources_DEFINED
|