2013-03-22 18:34:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrOvalRenderer_DEFINED
|
|
|
|
#define GrOvalRenderer_DEFINED
|
|
|
|
|
|
|
|
#include "GrContext.h"
|
|
|
|
#include "GrPaint.h"
|
|
|
|
#include "GrRefCnt.h"
|
|
|
|
|
|
|
|
class GrContext;
|
|
|
|
class GrDrawTarget;
|
|
|
|
class GrPaint;
|
2013-07-17 21:39:42 +00:00
|
|
|
struct SkRect;
|
2013-03-22 18:34:09 +00:00
|
|
|
class SkStrokeRec;
|
|
|
|
|
|
|
|
/*
|
2013-04-25 15:27:00 +00:00
|
|
|
* This class wraps helper functions that draw ovals and roundrects (filled & stroked)
|
2013-03-22 18:34:09 +00:00
|
|
|
*/
|
|
|
|
class GrOvalRenderer : public GrRefCnt {
|
|
|
|
public:
|
|
|
|
SK_DECLARE_INST_COUNT(GrOvalRenderer)
|
|
|
|
|
2013-04-25 15:27:00 +00:00
|
|
|
GrOvalRenderer() : fRRectIndexBuffer(NULL) {}
|
2013-07-11 22:29:29 +00:00
|
|
|
~GrOvalRenderer() {
|
|
|
|
this->reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset();
|
2013-03-22 18:34:09 +00:00
|
|
|
|
2013-05-02 13:11:22 +00:00
|
|
|
bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
|
2013-07-17 21:39:42 +00:00
|
|
|
const SkRect& oval, const SkStrokeRec& stroke);
|
2013-05-02 13:11:22 +00:00
|
|
|
bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA,
|
2013-04-25 15:27:00 +00:00
|
|
|
const SkRRect& rrect, const SkStrokeRec& stroke);
|
|
|
|
|
2013-03-22 18:34:09 +00:00
|
|
|
private:
|
2013-05-02 13:11:22 +00:00
|
|
|
bool drawEllipse(GrDrawTarget* target, bool useAA,
|
2013-07-17 21:39:42 +00:00
|
|
|
const SkRect& ellipse,
|
2013-03-22 18:34:09 +00:00
|
|
|
const SkStrokeRec& stroke);
|
2013-05-02 13:11:22 +00:00
|
|
|
void drawCircle(GrDrawTarget* target, bool useAA,
|
2013-07-17 21:39:42 +00:00
|
|
|
const SkRect& circle,
|
2013-03-22 18:34:09 +00:00
|
|
|
const SkStrokeRec& stroke);
|
|
|
|
|
2013-04-25 15:27:00 +00:00
|
|
|
GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
|
2013-04-26 07:00:58 +00:00
|
|
|
|
2013-04-25 15:27:00 +00:00
|
|
|
GrIndexBuffer* fRRectIndexBuffer;
|
2013-04-26 07:00:58 +00:00
|
|
|
|
2013-03-22 18:34:09 +00:00
|
|
|
typedef GrRefCnt INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GrOvalRenderer_DEFINED
|