152771272f4f018f4fc6846224bf047497e784af1Stan Iliev/* 252771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Copyright (C) 2016 The Android Open Source Project 352771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 452771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Licensed under the Apache License, Version 2.0 (the "License"); 552771272f4f018f4fc6846224bf047497e784af1Stan Iliev * you may not use this file except in compliance with the License. 652771272f4f018f4fc6846224bf047497e784af1Stan Iliev * You may obtain a copy of the License at 752771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 852771272f4f018f4fc6846224bf047497e784af1Stan Iliev * http://www.apache.org/licenses/LICENSE-2.0 952771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 1052771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Unless required by applicable law or agreed to in writing, software 1152771272f4f018f4fc6846224bf047497e784af1Stan Iliev * distributed under the License is distributed on an "AS IS" BASIS, 1252771272f4f018f4fc6846224bf047497e784af1Stan Iliev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1352771272f4f018f4fc6846224bf047497e784af1Stan Iliev * See the License for the specific language governing permissions and 1452771272f4f018f4fc6846224bf047497e784af1Stan Iliev * limitations under the License. 1552771272f4f018f4fc6846224bf047497e784af1Stan Iliev */ 1652771272f4f018f4fc6846224bf047497e784af1Stan Iliev 1752771272f4f018f4fc6846224bf047497e784af1Stan Iliev#pragma once 1852771272f4f018f4fc6846224bf047497e784af1Stan Iliev 1952771272f4f018f4fc6846224bf047497e784af1Stan Iliev#include <gtest/gtest.h> 2052771272f4f018f4fc6846224bf047497e784af1Stan Iliev#include <SkCanvas.h> 2152771272f4f018f4fc6846224bf047497e784af1Stan Iliev 2252771272f4f018f4fc6846224bf047497e784af1Stan Ilievnamespace { 2352771272f4f018f4fc6846224bf047497e784af1Stan Iliev 2452771272f4f018f4fc6846224bf047497e784af1Stan Ilievclass TestCanvasBase : public SkCanvas { 2552771272f4f018f4fc6846224bf047497e784af1Stan Ilievpublic: 2652771272f4f018f4fc6846224bf047497e784af1Stan Iliev TestCanvasBase(int width, int height) : SkCanvas(width, height) { 2752771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 2852771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawAnnotation(const SkRect&, const char key[], SkData* value) { 2952771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawAnnotation not expected in this test"; 3052771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) { 3252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawDRRect not expected in this test"; 3352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 3552771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint& paint) { 3652771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawText not expected in this test"; 3752771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3852771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 3952771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint& paint) { 4052771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPosText not expected in this test"; 4152771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 4252771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, 4352771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint& paint) { 4452771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPosTextH not expected in this test"; 4552771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 4652771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 4752771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkMatrix* matrix, const SkPaint& paint) { 4852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextOnPath not expected in this test"; 4952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 5052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform[], 5152771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkRect* cullRect, const SkPaint& paint) { 5252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextRSXform not expected in this test"; 5352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 5452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { 5552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextBlob not expected in this test"; 5652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 5752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], 5852771272f4f018f4fc6846224bf047497e784af1Stan Iliev SkBlendMode, const SkPaint& paint) { 5952771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPatch not expected in this test"; 6052771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 6152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPaint(const SkPaint&) { 6252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPaint not expected in this test"; 6352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 6452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRect(const SkRect&, const SkPaint&) { 6552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRect not expected in this test"; 6652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 6752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRegion(const SkRegion& region, const SkPaint& paint) { 6852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRegion not expected in this test"; 6952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawOval(const SkRect&, const SkPaint&) { 7152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawOval not expected in this test"; 7252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawArc(const SkRect&, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, 7452771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint&) { 7552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawArc not expected in this test"; 7652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRRect(const SkRRect&, const SkPaint&) { 7852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRRect not expected in this test"; 7952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 8052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) { 8152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPoints not expected in this test"; 8252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 83871cd2dd6074544bd41a84ff38255d81a392546aMike Reed void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) { 8452771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawVertices not expected in this test"; 8552771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 8652771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int count, 8752771272f4f018f4fc6846224bf047497e784af1Stan Iliev SkBlendMode, const SkRect* cull, const SkPaint*) { 8852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawAtlas not expected in this test"; 8952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPath(const SkPath&, const SkPaint&) { 9152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPath not expected in this test"; 9252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkPaint*) { 9452771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImage not expected in this test"; 9552771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9652771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*, 9752771272f4f018f4fc6846224bf047497e784af1Stan Iliev SrcRectConstraint) { 9852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageRect not expected in this test"; 9952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, const SkPaint*) { 10152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageNine not expected in this test"; 10252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageLattice(const SkImage*, const Lattice& lattice, const SkRect& dst, 10452771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint*) { 10552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageLattice not expected in this test"; 10652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const SkPaint*) { 10852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmap not expected in this test"; 10952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 11052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, 11152771272f4f018f4fc6846224bf047497e784af1Stan Iliev SrcRectConstraint) { 11252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapRect not expected in this test"; 11352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 11452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 11552771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint*) { 11652771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapNine not expected in this test"; 11752771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 11852771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapLattice(const SkBitmap&, const Lattice& lattice, const SkRect& dst, 11952771272f4f018f4fc6846224bf047497e784af1Stan Iliev const SkPaint*) { 12052771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; 12152771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 122d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) { 12352771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipRRect not expected in this test"; 12452771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 125d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) { 12652771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipPath not expected in this test"; 12752771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 128d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipRegion(const SkRegion& deviceRgn, SkClipOp) { 12952771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipRegion not expected in this test"; 13052771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 13152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDiscard() { 13252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDiscard not expected in this test"; 13352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 13452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) { 13552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPicture not expected in this test"; 13652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 13752771272f4f018f4fc6846224bf047497e784af1Stan Iliev 13852771272f4f018f4fc6846224bf047497e784af1Stan Iliev int mDrawCounter = 0; //counts how may draw calls of any kind were made to this canvas 13952771272f4f018f4fc6846224bf047497e784af1Stan Iliev}; 14052771272f4f018f4fc6846224bf047497e784af1Stan Iliev 14152771272f4f018f4fc6846224bf047497e784af1Stan Iliev}