Chromium Code Reviews| Index: tools/viewer/sk_app/RasterWindowContext.h |
| diff --git a/tools/viewer/sk_app/RasterWindowContext.h b/tools/viewer/sk_app/RasterWindowContext.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3916d9c4a54617bd76b587adb76b93237f1d3382 |
| --- /dev/null |
| +++ b/tools/viewer/sk_app/RasterWindowContext.h |
| @@ -0,0 +1,58 @@ |
| + |
| +/* |
| + * Copyright 2016 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| +#ifndef RasterWindowContext_DEFINED |
| +#define RasterWindowContext_DEFINED |
| + |
| +#include <android/native_window_jni.h> |
| + |
| +#include "SkImage.h" |
| +#include "WindowContext.h" |
| + |
| +namespace sk_app { |
| + |
| +class RasterWindowContext : public WindowContext { |
| +public: |
| + sk_sp<SkSurface> getBackbufferSurface() override; |
| + |
| + bool isValid() override { return true; } |
| + |
| + void resize(uint32_t w, uint32_t h) override { |
|
djsollen
2016/06/07 16:05:29
why doesn't the android subclass override this and
liyuqian
2016/06/07 19:19:57
I'm deleting RasterWindowContext since there isn't
|
| + // Override this in the subclass to allow resize |
| + SkDEBUGFAIL("Resize is currently unsupported."); |
| + } |
| + |
| + void swapBuffers() override; |
| + |
| + void setDisplayParams(const DisplayParams& params) override { |
| + // Override this in the subclass to allow setDisplayParams in runtime |
| + SkDEBUGFAIL("setDisplayParams is currently unsupported."); |
|
djsollen
2016/06/07 16:05:29
why doesn't the android subclass override this?
liyuqian
2016/06/07 19:19:57
I'm deleting RasterWindowContext since there isn't
|
| + } |
| + |
| + GrBackendContext getBackendContext() override { return (GrBackendContext) nullptr; } |
|
djsollen
2016/06/07 16:05:29
no need to cast the nullptr
liyuqian
2016/06/07 19:19:57
If not, it won't compile...
|
| + |
| +protected: |
| + // Make sure the the subclass will initialize fDisplayParams. |
| + // The subclass shall also set fWidth, fHeight in their constructions. |
| + RasterWindowContext(const DisplayParams& params) { |
| + fDisplayParams = params; |
| + } |
| + |
| + bool isGpuContext() override { return false; } |
| + |
| + SkImageInfo getImageInfo(); |
|
djsollen
2016/06/07 16:05:29
remove this function.
liyuqian
2016/06/07 19:19:57
Removed. Previously, we need this because of some
|
| + |
| + // The only method required to be implemented in the subclass |
| + virtual void onSwapBuffers(sk_sp<SkImage> image) = 0; |
| + |
| +private: |
| + sk_sp<SkSurface> fBackbufferSurface = nullptr; |
|
djsollen
2016/06/07 16:05:29
we shouldn't need to store this.
liyuqian
2016/06/07 19:19:57
We need to store this because one might call getBa
|
| +}; |
| + |
| +} // namespace sk_app |
| + |
| +#endif |