Robert Phillips | ad8a43f | 2017-08-30 12:06:35 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkSurfaceCharacterization_DEFINED |
| 9 | #define SkSurfaceCharacterization_DEFINED |
| 10 | |
| 11 | #include "GrTypes.h" |
| 12 | |
| 13 | class SkSurface; |
| 14 | |
| 15 | // This class captures all the pertinent data about an SkSurface required |
| 16 | // to perform cpu-preprocessing for gpu-rendering. |
| 17 | class SkSurfaceCharacterization { |
| 18 | public: |
| 19 | SkSurfaceCharacterization() |
| 20 | : fOrigin(kBottomLeft_GrSurfaceOrigin) |
| 21 | , fWidth(0) |
| 22 | , fHeight(0) |
| 23 | , fConfig(kRGBA_8888_GrPixelConfig) |
| 24 | , fSampleCnt(0) { |
| 25 | } |
| 26 | |
| 27 | void set(GrSurfaceOrigin origin, |
| 28 | int width, int height, |
| 29 | GrPixelConfig config, |
| 30 | int sampleCnt) { |
| 31 | fOrigin = origin; |
| 32 | fWidth = width; |
| 33 | fHeight = height; |
| 34 | fConfig = config; |
| 35 | fSampleCnt = sampleCnt; |
| 36 | } |
| 37 | |
| 38 | GrSurfaceOrigin origin() const { return fOrigin; } |
| 39 | int width() const { return fWidth; } |
| 40 | int height() const { return fHeight; } |
| 41 | GrPixelConfig config() const { return fConfig; } |
| 42 | int sampleCount() const { return fSampleCnt; } |
| 43 | |
| 44 | private: |
| 45 | GrSurfaceOrigin fOrigin; |
| 46 | int fWidth; |
| 47 | int fHeight; |
| 48 | GrPixelConfig fConfig; |
| 49 | int fSampleCnt; |
| 50 | // TODO: need to include caps! |
| 51 | // Maybe use GrContextThreadSafeProxy (it has the caps & the unique Context ID already) |
| 52 | }; |
| 53 | |
| 54 | #endif |