f41b2bd449
This reverts commitf21bf9e50b
. Reason for revert: relanding with infra fix Original change's description: > Revert "Merge GrOpList and GrRTOpList and rename to GrOpsTask." > > This reverts commit2a5954140b
. > > Reason for revert: breaking everything > > Original change's description: > > Merge GrOpList and GrRTOpList and rename to GrOpsTask. > > > > Change-Id: I8f4f2218a30fd0541a8f79f7bb9850f9500cd243 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236343 > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com > > Change-Id: I27840ea0343e8e6b388556afb7bd2e76386d611d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236349 > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: Ibd3a06e4a91dbb1f225dcc8d17d0db3967b6f85f No-Presubmit: true No-Tree-Checks: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236350 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "include/core/SkBitmap.h"
|
|
#include "include/private/SkTDArray.h"
|
|
|
|
class DrawCommand;
|
|
|
|
// This class encapsulates the both the in-memory representation of the draw ops
|
|
// and the state of Skia/Ganesh's rendering. It should never have any Qt intrusions.
|
|
class Model {
|
|
public:
|
|
enum class ErrorCode {
|
|
kOK,
|
|
kCouldntOpenFile,
|
|
kCouldntDecodeSKP
|
|
};
|
|
|
|
Model();
|
|
~Model();
|
|
|
|
static const char* ErrorString(ErrorCode);
|
|
|
|
// Replace the list of draw ops by reading the provided skp filename and
|
|
// reset the Skia draw state. It is up to the view portion to update itself
|
|
// after this call (i.e., rebuild the opsTask view).
|
|
ErrorCode load(const char* filename);
|
|
|
|
// Update the rendering state to the provided op
|
|
void setCurOp(int curOp);
|
|
int curOp() const { return fCurOp; }
|
|
|
|
int numOps() const { return fOps.count(); }
|
|
const char* getOpName(int index) const;
|
|
|
|
bool isHierarchyPush(int index) const;
|
|
bool isHierarchyPop(int index) const;
|
|
|
|
// Get the bits visually representing the current rendering state
|
|
void* getPixels() const { return fBM.getPixels(); }
|
|
int width() const { return fBM.width(); }
|
|
int height() const { return fBM.height(); }
|
|
|
|
protected:
|
|
// draw the ops up to (and including) the index-th op
|
|
void drawTo(int index);
|
|
void resetOpsTask();
|
|
|
|
private:
|
|
SkTDArray<DrawCommand*> fOps;
|
|
int fCurOp; // The current op the rendering state is at
|
|
SkBitmap fBM;
|
|
};
|