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"
|
|
|
|
#include "GrRect.h"
|
|
|
|
|
|
|
|
class GrContext;
|
|
|
|
class GrDrawTarget;
|
|
|
|
class GrPaint;
|
|
|
|
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-03-22 18:34:09 +00:00
|
|
|
~GrOvalRenderer() {}
|
|
|
|
|
2013-03-23 07:01:28 +00:00
|
|
|
bool drawOval(GrDrawTarget* target, const GrContext* context, const GrPaint& paint,
|
2013-03-22 18:34:09 +00:00
|
|
|
const GrRect& oval, const SkStrokeRec& stroke);
|
2013-04-25 15:27:00 +00:00
|
|
|
bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, const GrPaint& paint,
|
|
|
|
const SkRRect& rrect, const SkStrokeRec& stroke);
|
|
|
|
|
2013-03-22 18:34:09 +00:00
|
|
|
private:
|
2013-04-16 12:30:35 +00:00
|
|
|
bool drawEllipse(GrDrawTarget* target, const GrPaint& paint,
|
2013-03-22 18:34:09 +00:00
|
|
|
const GrRect& ellipse,
|
|
|
|
const SkStrokeRec& stroke);
|
|
|
|
void drawCircle(GrDrawTarget* target, const GrPaint& paint,
|
|
|
|
const GrRect& circle,
|
|
|
|
const SkStrokeRec& stroke);
|
|
|
|
|
2013-04-25 15:27:00 +00:00
|
|
|
GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu);
|
|
|
|
|
|
|
|
GrIndexBuffer* fRRectIndexBuffer;
|
|
|
|
|
2013-03-22 18:34:09 +00:00
|
|
|
typedef GrRefCnt INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GrOvalRenderer_DEFINED
|